Skip to content

Skip the review on bot and fork pull requests, and refuse forks on request - #7

Merged
GavinLucas merged 2 commits into
mainfrom
code-review-workflow
Oct 1, 2026
Merged

GavinLucas merged 2 commits into
mainfrom
code-review-workflow

Conversation

@claudeleet

@claudeleet claudeleet commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

GitHub gives no secrets to runs started by Dependabot or by a fork pull request, and the review action rejects bot actors, so the review job would fail red on every such pull request. Bot pull requests are reviewed by hand, by decision. Fork pull requests are not reviewed at all, by decision, including when a maintainer asks by comment: that run carries the token over text written by someone with no access.

  • New gate job (2-minute timeout), ahead of the review:
    • a fork pull request is refused with a notice, and with a reply comment when the request came by comment;
    • no token, or a bot actor, is skipped with a notice that says why;
    • otherwise the review runs.
  • CLAUDE_CODE_OAUTH_TOKEN input is no longer required, since an empty secret is one of the cases handled.
  • README: one bullet describing both.

Intended as v1.1.1.

Tested: actionlint clean. The gate script run locally, with a stand-in gh, across five cases: fork by comment (refused, reply posted), fork by event (refused, no reply), no token (skipped), dependabot[bot] (skipped), a person on a same-repository branch (runs). gh pr view --json isCrossRepository confirmed against a real pull request.

Not tested yet: a real Dependabot or fork pull request in Actions.

GitHub gives no secrets to a run that Dependabot or a fork pull request started, and the
review action rejects a bot actor, so the review would have ended as a red job on every such
pull request.  Bot pull requests are reviewed by hand by decision, so a gate job now checks
for the token and a human actor first, and skips with a notice when either is missing.  The
notice keeps the skip visible: a missing token on a pull request that is neither bot nor fork
means the secret is not set or not passed.

The token input is no longer marked required, because a required secret that arrives empty is
exactly the case being handled.  Tested locally by running the gate's script for no token, a
bot actor, and a person with a token.

Signed-off-by: Claude Leet <Claude@L337.org>
A maintainer's /claude-review on a fork pull request ran with the token over text written by
someone with no access to the repository, who could write it to steer the verdict.  Claude
holds no write token and has no network tools, so the exposure is a misleading verdict rather
than a leaked secret, but fork pull requests are now refused outright by decision.  A refused
comment request gets a reply so it does not look ignored.  The lookup runs first and on its
own, so a failure stops the job instead of reading as not a fork.  Tested locally with a
stand-in gh across five cases: fork by comment (refused, reply), fork by event (refused),
no token, bot actor, and a person on a same-repository branch (runs).

Signed-off-by: Claude Leet <Claude@L337.org>
@claudeleet claudeleet changed the title Skip the review on bot and fork pull requests instead of failing Skip the review on bot and fork pull requests, and refuse forks on request Oct 1, 2026
@GavinLucas
GavinLucas merged commit 8cb828d into main Oct 1, 2026
5 checks passed
@GavinLucas
GavinLucas deleted the code-review-workflow branch October 1, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants