Skip to content

Comments

"Claude PR Assistant workflow"#439

Merged
msaroufim merged 2 commits intomainfrom
add-claude-github-actions-1770536526843
Feb 8, 2026
Merged

"Claude PR Assistant workflow"#439
msaroufim merged 2 commits intomainfrom
add-claude-github-actions-1770536526843

Conversation

@msaroufim
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 8, 2026 07:42
@msaroufim msaroufim merged commit b8f58a4 into main Feb 8, 2026
7 of 8 checks passed
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds GitHub Actions workflows to run Anthropic Claude Code in response to repository activity (comment-driven assistant and automatic PR code review).

Changes:

  • Introduces a comment-/issue-triggered “Claude Code” workflow that runs when @claude is mentioned.
  • Introduces a PR-triggered “Claude Code Review” workflow that runs on PR lifecycle events and invokes a code-review plugin.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
.github/workflows/claude.yml New workflow to invoke Claude Code when @claude is detected in comments/reviews/issues.
.github/workflows/claude-code-review.yml New workflow to automatically run Claude-based code review on PR events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +11
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

The workflow can be triggered by anyone opening an issue or posting a comment containing @claude, which will run with secrets.ANTHROPIC_API_KEY available in the base repo context. This creates a real secret-exposure / prompt-injection risk and can also be abused to burn API quota. Restrict execution to trusted actors (e.g., check author_association/repo membership in the job if:) and/or remove the issues trigger (or limit to workflow_dispatch/maintainers only).

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +19
(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')))
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

contains() is evaluated on fields that can be null/empty (e.g., github.event.review.body for a submitted review without text, or github.event.issue.body for an issue created without a body). In GitHub Actions expressions this can cause the job if: evaluation to fail. Coerce these to empty strings (e.g., ...body || '') or add explicit null checks before calling contains().

Suggested change
(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_name == 'issues' && (contains(github.event.issue.body || '', '@claude') || contains(github.event.issue.title || '', '@claude')))

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +25
pull-requests: read
issues: read
id-token: write
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

The job permissions are set to pull-requests: read / issues: read, but this workflow is expected to respond back on PRs/issues when invoked. With read-only permissions, the action will be unable to create comments/reviews/status updates via the GITHUB_TOKEN. Grant the minimal required write scopes (typically pull-requests: write and/or issues: write), and consider dropping id-token: write unless the action is actually using OIDC.

Suggested change
pull-requests: read
issues: read
id-token: write
pull-requests: write
issues: write

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +42
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

additional_permissions requests actions: read, but the job already has actions: read in permissions. Keeping both is redundant and can confuse future maintenance; prefer a single source of truth (either rely on workflow permissions or remove the duplicated action input if it isn't required).

Suggested change
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
# Optional: Only run on specific file changes
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This workflow runs on pull_request events but depends on secrets.ANTHROPIC_API_KEY. For PRs from forks, GitHub will not provide repository secrets, so the action will fail (or behave unexpectedly) on those PRs. Add a job-level guard to skip forked PRs (e.g., if: github.event.pull_request.head.repo.fork == false) and/or document that it only supports same-repo branches.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +26
pull-requests: read
issues: read
id-token: write
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

The job permissions are read-only (pull-requests: read, issues: read), but a code review action typically needs to publish a review comment back onto the PR. With read-only permissions it won't be able to post results via GITHUB_TOKEN. Grant the minimal required write permissions (usually pull-requests: write; add issues: write only if it posts to issues) and consider removing id-token: write unless OIDC is actually used.

Suggested change
pull-requests: read
issues: read
id-token: write
pull-requests: write
issues: read

Copilot uses AI. Check for mistakes.
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.

1 participant