-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexport.sh
executable file
·47 lines (38 loc) · 1.13 KB
/
export.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Parse script arguments to get the issue number
while getopts ":i:" opt; do
case $opt in
i)
issue_number=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Check if the issue number is provided
if [ -z "$issue_number" ]; then
echo "Issue number is required (for example, $0 -i 80)"
exit 1
fi
repo="zmoog/public-notes"
owner="zmoog"
# issue_number="80"
#
# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#get-an-issue
#
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$repo/issues/$issue_number | jq -r '.body' > $issue_number.md
#
# https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments
#
# GitHub CLI api
# https://cli.github.com/manual/gh_api
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
repos/$repo/issues/$issue_number/comments | jq -r '.[].body' >> $issue_number.md
# Convert markdown to asciidoc
pandoc $issue_number.md -o $issue_number.adoc