Last active
June 29, 2022 21:51
-
-
Save ziadoz/37b999970a3b579f7f61c6a9232c7736 to your computer and use it in GitHub Desktop.
GitHub - Get All Your PRs As JSON
This file contains 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 | |
# Install GH CLI client | |
brew install gh | |
# Configure organisation and username variables | |
ORG="orgname" | |
USER="username" | |
# Retrieve pull request JSON | |
# @see: https://github.com/cli/cli/issues/1268 | |
gh api --method GET /search/issues --raw-field q='is:pr org:$ORG author:$USER' --paginate | jq 'reduce inputs as $i (.; . += $i)' > pull_requests.json | |
gh api --method GET /search/issues --raw-field q='type:pr author:$USER' --paginate | jq > pull_requests.json | |
gh api --method GET /search/issues --raw-field q='type:pr author:$USER' --jq '.items.[].title' --paginate > pull_requests.json | |
gh api --method GET /search/issues --raw-field q='type:pr author:$USER' --jq '.items.[] | {title,body}' --paginate > pull_requests.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment