Skip to content

Automate browser based workflows with AI

Add Claude Code GitHub Actions for PR reviews (#4595)

Suchintanae81b19669c0
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml
index ed2a9b37d..42ed76a6d 100644
--- a/.github/workflows/claude-code-review.yml
+++ b/.github/workflows/claude-code-review.yml
@@ -2,19 +2,14 @@ name: Claude Code Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
- # Optional: Only run on specific file changes
- # paths:
- # - "src/**/*.ts"
- # - "src/**/*.tsx"
- # - "src/**/*.js"
- # - "src/**/*.jsx"
jobs:
claude-review:
- # Optional: Filter by PR author
- # if: |
- # github.event.pull_request.user.login == 'external-contributor' ||
- # github.event.pull_request.user.login == 'new-developer' ||
- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
+ # Only auto-review PRs from external contributors (not maintainers)
+ # This helps community contributors get quick feedback while saving costs
+ if: |
+ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
+ github.event.pull_request.author_association == 'FIRST_TIMER' ||
+ github.event.pull_request.author_association == 'NONE'
runs-on: ubuntu-latest
permissions:
contents: read
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
index bfdd6b6bb..f97d6f820 100644
--- a/.github/workflows/claude.yml
+++ b/.github/workflows/claude.yml
@@ -4,17 +4,25 @@ on:
types: [created]
pull_request_review_comment:
types: [created]
- issues:
- types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
+ # Only allow @claude mentions from repository collaborators (not from issue/PR authors who may be external)
if: |
- (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')))
+ (
+ (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.sender.type == 'Bot' ||
+ github.event.comment.author_association == 'OWNER' ||
+ github.event.comment.author_association == 'MEMBER' ||
+ github.event.comment.author_association == 'COLLABORATOR' ||
+ github.event.review.author_association == 'OWNER' ||
+ github.event.review.author_association == 'MEMBER' ||
+ github.event.review.author_association == 'COLLABORATOR'
+ )
runs-on: ubuntu-latest
permissions:
contents: read