Closed ZhongRuoyu closed 8 months ago
gh pr list does not list any PRs from users with a private profile (cli/cli#6879), so let's use another method to count PRs.
gh pr list
This allows us to have a limit higher than 99 too, though not quite necessary.
Before:
$ gh pr list --state=open --author=BrewTestBot --json=number --jq=length --limit=100 23
After:
$ gh api \ --method GET \ --header 'Accept: application/vnd.github+json' \ --header 'X-GitHub-Api-Version: 2022-11-28' \ --field state=open \ --paginate \ '/repos/Homebrew/homebrew-core/pulls' | jq \ --raw-output \ --arg USER 'BrewTestBot' \ 'map(select(.user.login == $USER)) | length' 23
Honestly we probably should just use Octokit.js instead in actions like this as it has much less quirks and this is not the first time we've been bitten by gh doing a ton of extra logic we don't want.
gh
gh pr list
does not list any PRs from users with a private profile (cli/cli#6879), so let's use another method to count PRs.This allows us to have a limit higher than 99 too, though not quite necessary.
Before:
After: