-
Notifications
You must be signed in to change notification settings - Fork 7
/
gh_export_all.sh
32 lines (22 loc) · 901 Bytes
/
gh_export_all.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
#!/bin/bash -i
set -eu -o pipefail
mkdir -p github
if ! gh auth status | grep -q 'read:project'; then
(set -x; gh auth login --scopes read:project)
fi
(
echo Saving PRs
pr_out="github/pull_requests.json"
# all_pr_fields="$(echo $(gh pr list --json 2>&1 | tail -n +2) | sed 's/ /,/g')"
# gh pr list -L 50 --json "$all_pr_fields" | jq > $pr_out
gh api repos/bambosh/unofficial-homestuck-collection/pulls --paginate > $pr_out
logparam "Saved" $(jq '.|length' < "$pr_out") "pull requests to" "$pr_out"
)
(
echo Saving Issues
issue_out="github/issues.json"
# all_issue_fields="$(echo $(gh issue list --json 2>&1 | tail -n +2) | sed 's/ /,/g')"
# gh issue list -L 50 --json "$all_issue_fields" | jq > $issue_out
gh api repos/bambosh/unofficial-homestuck-collection/issues --paginate > $issue_out
logparam "Saved" $(jq '.|length' < "$issue_out") "issues to" "$issue_out"
)