GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add an allow_fork_prs input to skip pull requests from forks by mhegazy · Pull Request #2094 · anthropics/claude-code-action

Conversation

@mhegazy

@mhegazy mhegazy commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Human: @mhegazy

Requested by Mohamed · project thread

Adds an allow_fork_prs input. It is "true" by default, so nothing changes unless a workflow sets it.

With "false", the action skips a pull request whose branch is in another repository or in a deleted fork, whoever opened it and whatever event started the run, before it checks anything out. It also skips workflow_run events for a fork's run. Any value other than true counts as off, including an empty one.

How it works

  • Where the event says which repository the branch is in (pull_request, pull_request_target, reviews, review comments, workflow_run), the action decides before it asks for a token.
  • The event for a comment on the conversation doesn't say, so the action looks the pull request up, after the write access and trigger checks. If that fails, so does the run. The token needs pull-requests: read.
  • A skipped run logs a warning and succeeds without Claude's outputs, so a required check that only runs the action passes.
  • Tag mode's checkout refuses a fork too, as a second check.

docs/security.md says what the input doesn't cover: other steps in the workflow, events that don't name a pull request, commands in a session, and a fork's commits that are already in the repository.

Testing

  • bun test (1413 pass), tsc --noEmit, prettier --check and the workflow hardening check on Linux, with @octokit/rest 22.0.1 in place of the locked 21.1.1. Two tests start run.ts and fail if either check is taken out.
  • The whole action with CLI 2.1.326, mock GitHub and a scripted model: comments, reviews, review comments, pull_request_target, workflow_run and agent mode, with a fork, a deleted fork, a writer's own fork and a branch in the repository, with the input true, false and empty, and with a failing lookup.
  • Not run: a GitHub runner, a real model, GitHub Enterprise Server, macOS and Windows.

Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude @mhegazy
Add an allow_fork_prs input
0de12e3
Set to "false", the action skips pull requests from forks, and workflow_run
events for a fork's run, before it checks anything out. The default keeps
today's behavior.

Co-authored-by: mhegazy <[email protected]>
@mhegazy mhegazy self-assigned this Nov 17, 2026
claude[bot]
claude Bot reviewed Nov 17, 2026
View reviewed changes

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Beyond the inline comment, I also checked three things and ruled them out:

  • The skip after the comment lookup in src/entrypoints/run.ts still reaches the finally block that sets the github_token output, so the revoke step in action.yml still gets the app token.
  • A skipped fork run leaves a required check green. docs/security.md states that as intended.
  • A mention on a closed or merged fork pull request gets no run. The same section says the skip applies whether the pull request is open or closed.

This changes which pull requests the action will act on, so a human look at the gating is still worthwhile.

Extended reasoning...

The change adds an allow_fork_prs input (default "true"), a new src/github/validation/fork-pr.ts module, two early returns in src/entrypoints/run.ts, and a second check in setupBranch, plus docs and tests (10 files, +453/-6). It touches the action's trust boundary: whether fork code is checked out, and where the fork check sits relative to token setup and the write-access check. The only finding is a nit about where a test lives, but the gating logic is security-sensitive and not a mechanical change, so this is a defer and not an approval. No CODEOWNERS file covers the changed paths, and the timeline shows no other reviewer objections.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/fork-pr.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@claude @mhegazy
Keep a test's call loose so signature changes don't break it
a09fcea
Co-authored-by: mhegazy <[email protected]>
@mhegazy
mhegazy enabled auto-merge (squash) November 17, 2026 23:03
claude[bot]
claude Bot reviewed Nov 17, 2026
View reviewed changes

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I reviewed the updated PR and found no bugs in this pass. Because it adds a security control that decides which pull requests the action runs on, and that runs ahead of the write-access check, a human look would still be worthwhile.

What was reviewed:

  • isRefusedForkEvent and isCommentOnRefusedForkPr against the event shapes in src/github/context.ts: pull_request_target takes the pull_request path, a null head repository counts as a fork, and a failed pulls.get throws instead of letting the run continue.
  • Both early returns in src/entrypoints/run.ts: the finally block still sets the github_token output, so the App token revoke step in action.yml still runs after the comment-path skip.
  • The new throw in setupBranch sits only on the open-PR checkout path; closed and merged PRs branch from the base there and are skipped earlier in run.ts.
  • One design point for a human to weigh: with allow_fork_prs: "false", a fork's PR or review event returns success before the write-permission and trigger checks, so it logs a warning on every such event (including ones with no trigger phrase) and succeeds where a non-writer's run otherwise fails.
Extended reasoning...

The change adds an allow_fork_prs input wired through action.yml into a new src/github/validation/fork-pr.ts, two early returns in src/entrypoints/run.ts, and a defence-in-depth throw in src/github/operations/branch.ts, plus docs and about 300 lines of tests. It touches the action's trust boundary directly: which fork pull requests and workflow_run events get a token, a checkout and a session, and in what order that is decided relative to the write-permission check. No bugs were found, and the only commit since the earlier review is a one-line change to a test call. Deferring rather than approving because this is a new security-relevant control with design choices (skip-as-success, check ordering, documented gaps) that a maintainer should confirm; tests and typecheck were read, not run, in this review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ant-kurt
ant-kurt approved these changes Nov 18, 2026
View reviewed changes
@mhegazy
mhegazy merged commit e5812cd into main Nov 18, 2026
40 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mhegazy
mhegazy deleted the claude/allow-fork-prs branch November 18, 2026 00:09
@zupo zupo mentioned this pull request Nov 22, 2026
chore: Update dependencies to 2026-11-15 ParetoSecurity/passlet#96
Merged
@dotsweeper dotsweeper Bot mentioned this pull request Nov 23, 2026
Bump the "weekly-dependencies" group with 2 updates across multiple ecosystems YusukeIt0/dot-link#440
Merged
@giswqs giswqs mentioned this pull request Nov 28, 2026
ci(review): set allow_fork_prs so Claude reviews and fixes fork PRs again opengeos/RustGIS#3224
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@claude claude[bot] claude[bot] left review comments
@ant-kurt ant-kurt ant-kurt approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@mhegazy mhegazy

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mhegazy @ant-kurt @claude
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.