Skip to content

Add Claude Code GitHub Workflow#34

Merged
eli0shin merged 2 commits intomainfrom
add-claude-github-actions-1766867662307
Dec 27, 2025
Merged

Add Claude Code GitHub Workflow#34
eli0shin merged 2 commits intomainfrom
add-claude-github-actions-1766867662307

Conversation

@eli0shin
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!

Copilot AI review requested due to automatic review settings December 27, 2025 20:34
@eli0shin eli0shin merged commit a4d1a65 into main Dec 27, 2025
6 checks passed
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 enable Claude Code integration, allowing AI-assisted development through @claude mentions in issues and pull requests, as well as automatic code reviews on PRs.

Key Changes

  • Added .github/workflows/claude.yml for interactive Claude assistance triggered by @claude mentions
  • Added .github/workflows/claude-code-review.yml for automatic code reviews on opened/synchronized PRs

Reviewed changes

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

File Description
.github/workflows/claude.yml Main workflow that triggers Claude Code when @claude is mentioned in comments, reviews, or issues
.github/workflows/claude-code-review.yml Automated code review workflow that runs on PR open/sync events with customizable review criteria

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

pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The comment on line 26 states that 'actions: read' is required for Claude to read CI results on PRs, but this permission is already declared on line 26. The comment is redundant with the code. Consider removing the comment since the purpose is already clear from the additional_permissions section below (lines 39-41) which documents this feature more comprehensively.

Suggested change
actions: read # Required for Claude to read CI results on PRs
actions: read

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 Dec 27, 2025

Choose a reason for hiding this comment

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

The 'additional_permissions' configuration on lines 40-41 sets 'actions: read', but this permission is already declared in the permissions section on line 26. This duplication is redundant and may cause confusion. Remove the 'additional_permissions' section or the 'actions: read' from the permissions section to avoid duplication.

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 +22 to +24
contents: read
pull-requests: read
issues: read
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The workflow has read-only permissions but the PR description states "Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits." To create comments, branches, and commits, Claude needs write permissions. 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 27, 2025

Choose a reason for hiding this comment

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

The workflow has read-only permissions for pull-requests and issues, but the prompt instructs Claude to use 'gh pr comment' to leave feedback. This requires write permissions. Add 'pull-requests: write' and 'issues: write' to the permissions section to allow Claude to post review 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 27, 2025

Choose a reason for hiding this comment

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

The fetch-depth is set to 1, which performs a shallow clone. For Claude Code to properly analyze changes and context, especially when reviewing PRs, it may need access to more commit history. Consider increasing fetch-depth to 0 (full history) or a larger number to ensure Claude has adequate context for analysis.

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 27, 2025

Choose a reason for hiding this comment

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

The fetch-depth is set to 1, which performs a shallow clone. For code review purposes, Claude may need access to more commit history to understand the context of changes and compare against base branches. Consider increasing fetch-depth to 0 (full history) or a larger number to ensure adequate context for thorough reviews.

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

Copilot uses AI. Check for mistakes.
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The workflow is triggered on 'issues' with types 'opened' and 'assigned'. However, the condition on line 19 only checks if the issue body or title contains '@claude'. This means the workflow will run for every issue assignment even if @claude is not mentioned, wasting CI resources. Consider removing 'assigned' from the trigger types or adjusting the condition to handle assignments differently.

Suggested change
types: [opened, assigned]
types: [opened]

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