CI: fix claude-code-review.yml, bump Actions, add gate job - #3
Open
jnasbyupgrade wants to merge 5 commits into
Open
CI: fix claude-code-review.yml, bump Actions, add gate job#3jnasbyupgrade wants to merge 5 commits into
jnasbyupgrade wants to merge 5 commits into
Conversation
Same issue as pgxntool-test#61/pgxntool#84: the /code-review plugin only prints its findings to the job log by default; it needs --comment to post a PR comment. Every automated review here has run correctly but never posted anything visible on the PR.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…oggle Three fixes to claude-code-review.yml, folded into this PR alongside the --comment fix since they all touch the review workflow: - The existing checkout step redirected `origin` to the PR's fork via `repository:`/`ref:` + `allow-unsafe-pr-checkout: true`. That breaks anthropics/claude-code-action's own internal PR fetch (it runs `git fetch origin pull/<N>/head`, a ref that only exists on the base repo) with "couldn't find remote ref pull/<N>/head" -- the same bug root-caused and fixed in Postgres-Extensions/extension_tools#28. Fix: drop the override entirely and just check out the base branch; the action fetches the actual PR head itself. - Add `track_progress: true` so a long review posts a live-updating tracking comment instead of staying silent until the whole run finishes (cat_tools PR #69). - Add a `claude-debug` PR label toggle: skips the cost gate and turns on `show_full_output` for a fast, fully-verbose debug iteration instead of a 5-20+ minute wait per attempt (cat_tools PR #64). Ported from cat_tools' current claude-code-review.yml, which already has all three fixes live.
Two more fixes from cat_tools' current claude-code-review.yml, per
~/security-notice.md's two newly-added addenda:
- actions: write permission -- without it, claude-code-action's own
setup step fails to save its Actions cache with a silent warning
("Cache reservation failed: cache write denied"), not a hard failure,
so the job still passes while being slower/less-cached every run.
There's no narrower "cache write only" scope GitHub offers.
- claude_args --allowedTools for mcp__github_inline_comment__create_inline_comment
-- agent mode (a bare prompt: with no @claude mention) only starts
the inline-comment MCP server if this tool is listed in an
--allowedTools flag inside claude_args; it does not consult the
code-review plugin's own allowed-tools frontmatter. Without it every
review silently falls back to one consolidated PR comment instead of
real inline line comments, with no error to notice (cat_tools PR #62).
Ported from cat_tools PR #47 and #62 respectively.
Folds in #6. head.repo.owner.login only distinguishes fork ownership for fork-headed PRs. For an upstream-branch-headed PR (base and head both in this repo -- what `gh stack` requires, or any `gh pr create` without forking), head.repo is always this repo itself, so head.repo.owner.login is always the org, never the actual author -- silently skipping review on PRs that were legitimately the trusted account's own work (confirmed elsewhere via the Checks API reporting claude-review as "skipped" on a trusted upstream-branch PR stack). Check github.event.pull_request.user.login instead: it can't be spoofed by a third party any more than head repo owner can, and it's the more direct question for this gate's actual purpose -- trusting the PERSON asking for a review, not the repository their branch happens to live in. Applied on top of this PR's already-restructured `if:` (the claude-debug label clause), rather than as PR #6's standalone diff against the original file, since both touch the same line and #6 was opened against the pre-PR-3 version of this workflow.
Folds in #4 and #7 (both closed in favor of this PR): - #4's actions/checkout@v6 -> v7 bump on claude.yml and ci.yml's `test` job. Its bump to claude-code-review.yml's checkout step is superseded by this PR's earlier commit, which already rewrote that step to use v7 as part of removing the broken fork-checkout override entirely. - #7's all-checks-passed gate job in ci.yml (needs: [test], if: always(), fails on failure/cancelled -- a stable required-status-check name that survives future job renames) and dropping paths-ignore: '**.md' from both triggers, since a doc-only push/PR would otherwise never run this workflow at all and a required all-checks-passed check would sit stuck Pending forever instead of passing. Its new job's own checkout step is bumped to v7 too, for consistency with the rest of this commit. Branch protection requiring all-checks-passed is still a manual follow-up after this merges -- that's a live repo setting, not something a merge can apply. See the PR description's reminder.
This was referenced Aug 9, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Have claude setup branch protection when this merges! (requiring the new
all-checks-passedcontext onmain-- see the last bullet below.)Summary
This PR now bundles every open CI-only PR in this repo (all diffs confined to
.github/workflows/), consolidated per request rather than left as separateoverlapping PRs:
/code-reviewplugin only prints its findings to the job log by default; it needs--commentto post a PR comment. This workflow's prompt was missing that flag, so every automated review has run (real API cost, correct analysis) but never posted anything visible to the PR.originto the PR's fork viarepository:/ref:+allow-unsafe-pr-checkout: true. That breaksanthropics/claude-code-action's own internalgit fetch origin pull/<N>/head(a ref that only exists on the base repo) with "couldn't find remote ref pull//head" -- same bug root-caused and fixed in CI: fix claude-code-review by removing the fork-checkout step entirely extension_tools#28. Fixed the same way: drop the override, just check out the base branch.track_progress: true(live-updating tracking comment instead of a silent run until completion -- cat_tools PR #69) and aclaude-debugPR label toggle (skips the cost gate + turns onshow_full_outputfor a fast debug iteration -- cat_tools PR #64).permissions: actions: write(there's no narrower "cache-write-only" scope; without itclaude-code-action's own setup step silently fails to save its Actions cache every run -- cat_tools PR #47) andclaude_args: --allowedTools mcp__github_inline_comment__create_inline_comment(agent-modeclaude-code-actiononly starts the inline-comment MCP server if this is listed here, not from the plugin's own frontmatter; without it every review silently falls back to one consolidated comment instead of real inline comments -- cat_tools PR #62).head.repo.owner.login, which only identifies fork ownership for fork-headed PRs. For an upstream-branch-headed PR (same-repo branch, e.g. fromgh stack), that's always the org itself, never the actual author -- silently skipping review on PRs that were legitimately the trusted account's own work. Now checksgithub.event.pull_request.user.logininstead.actions/checkout@v6pins (onclaude.ymlandci.yml'stestjob) tov7. Its bump to this file's own checkout step is superseded by this PR's fork-checkout fix above, which already moved tov7as part of removing the broken override.all-checks-passedjob toci.yml(needs: [test],if: always()) as a required-status-check name that survives future job renames/matrix changes, instead of requiring a real job name directly -- mirrorsPostgres-Extensions/pg_count_nulls' pattern. Also dropspaths-ignore: '**.md'fromci.yml's triggers: with it, a doc-only push/PR never runs the workflow at all, so a requiredall-checks-passedcheck would sit stuckPendingin branch protection forever instead of passing. This PR does not itself configure branch protection -- that's a live repo setting (gh api --method PUT .../branches/main/protection), not something a git merge can apply; needs to be done manually after merge.claude-code-review.yml-specific fixes (everything except the trust-gate author check) were ported from cat_tools' current, liveclaude-code-review.yml, which already has all of them.Test plan
--commentfix was live-verified against pgxntool-test's identical workflow before being ported here unchanged.pull_request_target-workflows-can't-verify-themselves rule: this PR's ownclaude-reviewcheck still runs the OLD workflow offmainand can't demonstrate any of theclaude-code-review.ymlfixes on itself. Verification (fork-checkout no longer errors, tracking comment appears,claude-debuglabel works, cache-write warning gone, inline comments post, review no longer skips on upstream-branch PRs) only happens on a subsequent PR after this merges.mainrequiring theall-checks-passedcontext, then confirm on an open PR thatmergeStateStatusreflects a real pending/completed run rather than showingCLEANwith no check having run.