Last active
July 24, 2018 22:57
-
-
Save rms1000watt/600690c6f11c262475eb66a7c82cbe72 to your computer and use it in GitHub Desktop.
Pull PRs From Github
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| get-all() { | |
| if [[ -z $GITHUB_ACCESS_TOKEN ]]; then | |
| echo "ERROR: no GITHUB_ACCESS_TOKEN defined" | |
| exit 1 | |
| fi | |
| pages=(1 2 3 4 5 6 7 8) | |
| for page in ${pages[*]}; do | |
| curl -H "Authorization: token $GITHUB_ACCESS_TOKEN" "https://api.github.com/repos/rms1000watt/serverless-tf/pulls?state=closed&page=$page" > "prs-page-$page.json" | |
| sleep 5 | |
| done | |
| } | |
| join-all() { | |
| prFiles="" | |
| for file in prs-page-*.json; do | |
| prFiles+=" $file" | |
| done | |
| jq -s '.|flatten' $prFiles > prs-all.json | |
| } | |
| parse-all() { | |
| jq '.[].title' < prs-all.json | |
| } | |
| case "$1" in | |
| get-all) | |
| get-all;; | |
| join-all) | |
| join-all;; | |
| parse-all) | |
| parse-all;; | |
| *) | |
| echo "bad command" && exit 1;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment