Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ jobs:
# rather than cancelling it, so a partial run never leaves comments/threads
# in an inconsistent state.
concurrency:
group: claude-pr-review-${{ github.event.pull_request.number }}
group: claude-pr-review-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: false
if: |
github.event_name == 'pull_request' &&
(github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
github.event.action == 'ready_for_review' ||
github.event.action == 'reopened')
(github.event_name == 'pull_request' &&
(github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
github.event.action == 'ready_for_review' ||
github.event.action == 'reopened')) ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
github.event.comment.user.login != 'mega-maxwell[bot]')
Comment on lines +65 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep fork code out of the privileged comment workflow

For a comment on a fork-based PR, issue_comment runs the trusted default-branch workflow with repository secrets available, and this condition lets any commenter trigger the job; the subsequent checkout loads the fork's mutable PR head before invoking Claude with both the OAuth secret and a repository installation token. A fork author can therefore place hostile agent instructions in the branch and post an ordinary comment to make the privileged agent process them, bypassing the secret withholding that protects normal pull_request runs from forks. Gate this path on a trusted author association, or run fork reconciliation without privileged credentials and write access.

Useful? React with 👍 / 👎.

Comment on lines +65 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Route @claude comments to only one Claude job

When a member, collaborator, or owner posts a top-level PR comment containing @claude, it satisfies both the existing interactive condition and this new unconditional PR-comment branch. The jobs have no shared concurrency, and the interactive job has contents: write, so a request that edits the branch can race with pr-review checking out and reviewing the old head, producing stale findings in addition to running two paid agents for one comment. Exclude interactive-command comments from this branch, or serialize the review after the interactive job.

Useful? React with 👍 / 👎.

runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
Expand All @@ -83,6 +86,7 @@ jobs:

- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
submodules: recursive
Expand Down
Loading