Skip to content

Instantly share code, notes, and snippets.

@sxzz
Last active November 5, 2023 09:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sxzz/71e06347027dc221492cd3e360683a2d to your computer and use it in GitHub Desktop.
Save sxzz/71e06347027dc221492cd3e360683a2d to your computer and use it in GitHub Desktop.
GitHub CLI scripts
# Get the owner of the repository to which you contributed (Pull Requests)
gh api graphql --paginate -f query='
query($endCursor: String) {
user(login: "username") {
pullRequests(first: 100, after: $endCursor, states: MERGED) {
nodes { repository { owner { login } } }
pageInfo {
hasNextPage
endCursor
}
}
}
}
' --jq '.data.user.pullRequests.nodes[].repository.owner.login' | sort | uniq -c | sort -r
# Merge all dependency PRs
gh search prs --owner sxzz is:open author:app/renovate archived:false --json "url" --jq ".[].url" | xargs -I {} gh pr merge {} --squash --auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment