Skip to content

Add Claude Code GitHub Workflow#2

Merged
differentmatt merged 3 commits intomasterfrom
add-claude-github-actions-1767209015317
Dec 31, 2025
Merged

Add Claude Code GitHub Workflow#2
differentmatt merged 3 commits intomasterfrom
add-claude-github-actions-1767209015317

Conversation

@differentmatt
Copy link
Owner

🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

Important Notes

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

There's more information in the Claude Code action repo.

After merging this PR, let's try mentioning @claude in a comment on any PR to get started!

Copy link

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

This PR adds GitHub Actions workflows to integrate Claude Code, an AI coding agent, into the repository. The integration enables two main features: interactive Claude assistance via @claude mentions in issues/PRs, and automated code reviews on new/updated pull requests.

Key Changes:

  • Added interactive Claude workflow triggered by @claude mentions in comments and issues
  • Added automated Claude code review workflow that runs on PR open/synchronize events
  • Configured permissions, triggers, and tool restrictions for both workflows

Reviewed changes

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

File Description
.github/workflows/claude.yml Main workflow enabling interactive Claude Code assistance via @claude mentions in PR/issue comments
.github/workflows/claude-code-review.yml Automated workflow that triggers Claude to perform code reviews on all new or updated pull requests

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

Comment on lines +22 to +24
contents: read
pull-requests: read
issues: read
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

The claude workflow is missing write permissions required for Claude to actually perform actions. The current permissions only allow reading, but Claude needs to create branches, commits, and comments. Add pull-requests: write, issues: write, and contents: write to the permissions section.

Suggested change
contents: read
pull-requests: read
issues: read
contents: write
pull-requests: write
issues: write

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

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

The claude-review workflow is missing write permissions needed for Claude to post code review comments. While the prompt instructs Claude to use gh pr comment, the workflow only has pull-requests: read permission. Add pull-requests: write and issues: write to enable Claude to post comments.

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

Copilot uses AI. Check for mistakes.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

Setting fetch-depth: 1 creates a shallow clone that only includes the latest commit. This limits Claude's ability to understand the full context of changes, especially for reviewing diffs. Consider using fetch-depth: 0 to fetch the full git history, or at minimum a deeper history that includes the PR's base branch.

Suggested change
fetch-depth: 1
fetch-depth: 0

Copilot uses AI. Check for mistakes.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

Setting fetch-depth: 1 limits Claude's ability to review the full context of changes in the PR. For code reviews, Claude needs access to the base branch and PR branch history to properly understand diffs. Consider using fetch-depth: 0 or removing this parameter to use the default behavior that fetches sufficient history for PR reviews.

Suggested change
fetch-depth: 1
fetch-depth: 0

Copilot uses AI. Check for mistakes.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

The allowed tools list restricts Claude to read-only GitHub CLI operations, but the prompt instructs Claude to use gh pr comment to post review feedback. The pattern Bash(gh pr comment:*) only allows reading comment content. To enable posting comments, update to Bash(gh pr comment *) (without the colon) to allow the full comment command including write operations.

Suggested change
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment *),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

Copilot uses AI. Check for mistakes.
@differentmatt
Copy link
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link

Copilot AI commented Dec 31, 2025

@differentmatt I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: differentmatt <2965172+differentmatt@users.noreply.github.com>
@differentmatt differentmatt merged commit 595454d into master Dec 31, 2025
1 check 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.

3 participants