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
17 changes: 12 additions & 5 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Claude Code

permissions: {}

on:
pull_request:
branches: [main]
Expand All @@ -10,6 +8,10 @@ on:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [labeled]

permissions: {}

jobs:
claude:
Expand All @@ -21,16 +23,21 @@ jobs:
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
(github.event_name == 'pull_request_review_comment' &&
contains(github.event.comment.body, '@claude') &&
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
(github.event_name == 'issues' && github.event.action == 'labeled' &&
github.event.label.name == 'claude')
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
# write required for issue-triggered branch creation
contents: write
id-token: write
pull-requests: write
issues: write
Comment on lines 31 to 36

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

contents: write is now granted for the entire job across all triggers (including automatic runs on pull_request synchronize/open). If write access is only needed for the issue-label workflow (branch creation), consider splitting into separate jobs/workflows so PR/comment handling can keep contents: read (least-privilege) and only the issue-triggered path gets write permissions.

Copilot uses AI. Check for mistakes.
steps:
- name: Run Claude Code
uses: anthropics/claude-code-action@e7b588b6eaa5263c2e7c6c7b34a29e190d32ee68 # v1
if: github.event_name != 'pull_request' || github.event.pull_request.user.login != 'dependabot[bot]'

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

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

The step-level dependabot guard uses github.event.pull_request.user.login, but this workflow also runs on issue_comment, pull_request_review_comment, and issues events where github.event.pull_request may be unset. This can lead to expression evaluation errors and it also won鈥檛 skip dependabot PRs when triggered via comment/review-comment events. Consider rewriting the condition to only reference pull_request fields when event_name == 'pull_request', and add equivalent dependabot checks for the comment/review-comment triggers (e.g., using the PR/issue author login available in those payloads or by fetching the PR via API).

Suggested change
if: github.event_name != 'pull_request' || github.event.pull_request.user.login != 'dependabot[bot]'
if: >-
(github.event_name == 'pull_request' &&
github.event.pull_request.user.login != 'dependabot[bot]') ||
(github.event_name == 'issue_comment' &&
github.event.issue.user.login != 'dependabot[bot]') ||
(github.event_name == 'pull_request_review_comment' &&
github.event.pull_request.user.login != 'dependabot[bot]') ||
(github.event_name == 'issues' &&
github.event.issue.user.login != 'dependabot[bot]')

Copilot uses AI. Check for mistakes.
uses: anthropics/claude-code-action@6e2bd52842c65e914eba5c8badd17560bd26b5de # v1.0.89
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
label_trigger: "claude"
Loading