diff --git a/.github/workflows/auto-approve-version-bump.yml b/.github/workflows/auto-approve-version-bump.yml index 997ee6496..c2cd8b617 100644 --- a/.github/workflows/auto-approve-version-bump.yml +++ b/.github/workflows/auto-approve-version-bump.yml @@ -50,11 +50,12 @@ jobs: exit 0 fi # Reopened PRs re-trigger this workflow; don't stack duplicate reviews. - # The reviews endpoint is paginated (30/page), so --paginate --slurp - # gathers every page into one array (of pages) before counting - a - # single count across all reviews rather than one per page. - approved=$(gh api --paginate --slurp "repos/$REPO/pulls/$PR/reviews" \ - --jq '[.[][] | select(.user.login == "github-actions[bot]" and .state == "APPROVED")] | length') + # The reviews endpoint is paginated (30/page). Current gh rejects + # combining --paginate --slurp with --jq, so count approvals per page + # and sum (awk). That matches the GHA ubuntu-latest gh CLI. + approved=$(gh api --paginate "repos/$REPO/pulls/$PR/reviews" \ + --jq '[.[] | select(.user.login == "github-actions[bot]" and .state == "APPROVED")] | length' \ + | awk '{s+=$1} END {print s+0}') if [ "$approved" -gt 0 ]; then echo "PR #$PR already approved by github-actions[bot]; nothing to do." exit 0