Skip to content

fix(audit): split slurp + jq for gh CLI 2.59+#20

Merged
jan-kubica merged 2 commits into
mainfrom
fix/audit-paginate-slurp-incompat
May 13, 2026
Merged

fix(audit): split slurp + jq for gh CLI 2.59+#20
jan-kubica merged 2 commits into
mainfrom
fix/audit-paginate-slurp-incompat

Conversation

@jan-kubica
Copy link
Copy Markdown
Contributor

Summary

  • gh api --paginate --slurp --jq started failing once GitHub-hosted runners picked up gh CLI ≥ 2.59, which made --slurp and --jq mutually exclusive. Pipe to jq separately to preserve the original "flatten paginated pages, default to []" behavior. Fixes the scheduled Audit Branch Protection job (last run failed in stella/stella with the --slurp option is not supported with --jq or --template).

Test plan

  • Trigger the caller workflow on stella/stella (or another consumer repo) via workflow_dispatch and confirm the Fetch live rulesets step exits 0.
  • Verify live-rulesets.json contents look correct (flat array, or [] for a repo without rulesets).
  • Next scheduled Monday 08:00 UTC run is green.

@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@jan-kubica jan-kubica marked this pull request as ready for review May 13, 2026 11:14
@jan-kubica jan-kubica requested a review from nnad3N as a code owner May 13, 2026 11:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c47b4f4a34

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/audit-branch-protection.yml
`gh api --paginate --slurp --jq` started failing once the runner
picked up gh CLI 2.59 or newer, where `--slurp` and `--jq` are
mutually exclusive ("the --slurp option is not supported with
--jq or --template"). Pipe to jq separately to keep the same
"flatten paginated pages, default to []" semantics.

Fixes the failing scheduled Audit Branch Protection job.
@jan-kubica jan-kubica force-pushed the fix/audit-paginate-slurp-incompat branch from c47b4f4 to ac3e762 Compare May 13, 2026 11:26
Without pipefail, a failing `gh api` upstream of `| jq 'add // []'`
would let the step exit 0 — jq emits `[]` on empty stdin, and the
default `bash -e {0}` only checks the last command's status. That
masked auth/rate-limit/5xx errors and produced a false "no drift"
result. Pin a custom shell with `-eo pipefail` for this step.

Also use `jq . live-rulesets.json` directly instead of `cat | jq` to
keep the same pipefail discipline in the debug print.

Addresses codex P2 review on PR #20.
@jan-kubica
Copy link
Copy Markdown
Contributor Author

CC on behalf of @jan-kubica

Addressed in 5fcdd28: the step now runs with shell: bash --noprofile --norc -eo pipefail {0}. Without pipefail, a failing gh api upstream of the jq pipe would still let the step exit 0 because jq 'add // []' returns [] and 0 on empty stdin — masking auth, rate-limit, or 5xx errors and producing a false "no drift" outcome. Also replaced cat live-rulesets.json | jq . with jq . live-rulesets.json to keep the same pipefail discipline in the debug print.

@jan-kubica jan-kubica merged commit a80fc97 into main May 13, 2026
1 check passed
@jan-kubica jan-kubica deleted the fix/audit-paginate-slurp-incompat branch May 13, 2026 11:28
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant