Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created March 25, 2023 01:57
Show Gist options
  • Select an option

  • Save KyMidd/284a26907efc22c0db4280e5857a93e0 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/284a26907efc22c0db4280e5857a93e0 to your computer and use it in GitHub Desktop.
# Less than or equal to 100 branches, get them all in one request
if [[ $REPO_BRANCH_COUNT -le 100 ]]; then
ALL_BRANCHES=$(curl -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/$GH_ORG/$GH_REPO/branches?per_page=100 | jq -r '.[].name')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment