-
-
Save KyMidd/b668458a3c10d77b69a85cb4a0aff005 to your computer and use it in GitHub Desktop.
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
| # This amazingly hacky way to get a repo count appears to be the only way, no official support in the APIs | |
| # https://stackoverflow.com/a/33252219/12072110 | |
| REPO_BRANCH_COUNT=$(curl -vvvs \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN"\ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| "https://api.github.com/repos/$GH_ORG/$GH_REPO/branches?per_page=1" 2>&1 1>/dev/null \ | |
| | grep -E '< link: <https://' \ | |
| | rev \ | |
| | cut -d ">" -f 2 \ | |
| | cut -d "=" -f1 \ | |
| | rev) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment