Skip to content

Conversation

@vegaro
Copy link
Member

@vegaro vegaro commented Jan 16, 2026

- claude-code-review.yml: Automatic PR code review for org members
- claude.yml: Responds to @claude mentions in issues and PR comments

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Contributor

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

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

I like it! One question though, to be extra safe 🔒

Comment on lines 19 to 20
github.event.issue.author_association == 'MEMBER' ||
github.event.issue.author_association == 'OWNER' ||
Copy link
Contributor

@ajpallares ajpallares Jan 16, 2026

Choose a reason for hiding this comment

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

Does this mean that anyone outside the org can trigger a claude code review on a PR created by anyone in the org?

I wonder, should this condition be under &&?

        github.event.issue.author_association == 'MEMBER' ||
        github.event.issue.author_association == 'OWNER'

Copy link
Member Author

@vegaro vegaro Jan 16, 2026

Choose a reason for hiding this comment

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

Not sure I follow. Just updated this to be only MEMBER, which btw means member of the org. Owner is owner of the repository.

How can someone trigger a code review?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering: say I open a PR:

github.event.issue.author_association == 'MEMBER' --> `true`

Then someone outside of the org posts a comment in that PR mentioning @claude:

github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))` --> `true`

Which means the @claude review is triggered.

Wouldn't it be better if we did:

      (
        github.event.issue.author_association == 'MEMBER' && 
        (
            github.event.comment.author_association == 'MEMBER' ||
            github.event.review.author_association == 'MEMBER'
        ) 
      ) && (
        (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
        (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
        (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
        (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))

To make sure that case above can't happen? Maybe I'm not understanding it right

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I see. I think what would happen in a comment is that github.event.issue doesn't exist. The content of event depends on the type of event that triggers the workflow. So in a comment by an external contributor, github.event.comment.author_association == 'MEMBER' won't be true and it won't even start anything

Copy link
Member Author

Choose a reason for hiding this comment

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

but let me confirm, because issue_comment might actually have both issue and comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

in any case I believe this covers us. https://github.com/anthropics/claude-code-action/blob/main/docs/security.md#access-control

Repository Access: The action can only be triggered by users with write access to the repository
⚠️ Non-Write User Access (RISKY): The allowed_non_write_users parameter allows bypassing the write permission requirement. This is a significant security risk and should only be used for workflows with extremely limited permissions (e.g., issue labeling workflows that only have issues: write permission).

Copy link
Member Author

Choose a reason for hiding this comment

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

43cb87d added this to be extra safe, this change prevents issue_comments events from outsiders from evaluating to true

Copy link

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

I think this looks great! Excited to get this running 🙌


on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]

Choose a reason for hiding this comment

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

Should we only ask for reviews when it's ready_for_review?

Copy link
Member Author

Choose a reason for hiding this comment

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

and synchronize?

Copy link
Member Author

Choose a reason for hiding this comment

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

also, I believe ready_for_review is only triggered when changed from draft to ready

Copy link
Member Author

Choose a reason for hiding this comment

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

I filtered draft PRs further down

claude-review:
# Only allow org members and owners to trigger Claude reviews
if: |
github.event.pull_request.author_association == 'MEMBER'

Choose a reason for hiding this comment

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

I know before we were also checking whether the author was an "OWNER". Since this seems to be comparing a string directly, would it also work for owners with this? I guess we can always merge this and test it, and if it doesn't work add it back.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my thinking for having both. But by my searches it looks like Owners are also Members, but you're right this is just a string comparison. In any case it's owners of the repository, which is mostly no one that actively works on the repositories.

Copy link
Contributor

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

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

Very cool! Looking forward to using this in our PRs! 🤖

@vegaro vegaro merged commit 427c6f8 into main Jan 19, 2026
4 checks passed
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.

4 participants