Skip to content

Conversation

@MarjovanLier
Copy link
Owner

@MarjovanLier MarjovanLier commented May 23, 2025

User description

🤖 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 documentation.

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


PR Type

enhancement, configuration changes


Description

  • Add GitHub Actions workflow to integrate Claude Code AI assistant

  • Restrict workflow execution to specific user and repository

  • Grant write permissions for pull requests and issues to enable Claude responses

  • Securely use Anthropic API key from GitHub secrets


Changes walkthrough 📝

Relevant files
Configuration changes
claude.yml
Add and secure Claude Code GitHub Actions workflow             

.github/workflows/claude.yml

  • Introduces a new workflow for Claude Code AI integration
  • Triggers on comments and reviews mentioning @claude
  • Restricts execution to the MarjovanLier user and repository
  • Sets permissions for pull requests and issues to write
  • Uses Anthropic API key from GitHub secrets for authentication
  • +39/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • Chores
      • Introduced a new GitHub Actions workflow that responds to "@claude" mentions in issues and comments, automating interactions with the Claude Code action.

    @MarjovanLier MarjovanLier requested a review from Copilot May 23, 2025 19:38
    @gemini-code-assist
    Copy link

    Note

    Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

    @coderabbitai
    Copy link

    coderabbitai bot commented May 23, 2025

    📝 Walkthrough

    Walkthrough

    A new GitHub Actions workflow configuration file is added to automate the invocation of the "Claude Code" GitHub Action when specific GitHub events occur and the "@claude" mention is detected in comments or issues.

    Changes

    File(s) Change Summary
    .github/workflows/claude.yml Added new workflow to trigger the "Claude Code" action on issue comments, PR reviews, and issues containing "@claude".

    Sequence Diagram(s)

    sequenceDiagram
        participant GitHub User
        participant GitHub Events
        participant Workflow Runner
        participant Claude Code Action
    
        GitHub User->>GitHub Events: Create comment/issue/PR review (with "@claude")
        GitHub Events->>Workflow Runner: Trigger workflow if "@claude" detected
        Workflow Runner->>Claude Code Action: Execute action with API key
        Claude Code Action-->>Workflow Runner: Process and respond
    
    Loading

    📜 Recent review details

    Configuration used: .coderabbit.yaml
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between af7cae1 and 97eb40a.

    📒 Files selected for processing (1)
    • .github/workflows/claude.yml (1 hunks)
    🚧 Files skipped from review as they are similar to previous changes (1)
    • .github/workflows/claude.yml
    ⏰ Context from checks skipped due to timeout of 90000ms (2)
    • GitHub Check: guardrails/scan
    • GitHub Check: Codacy Static Code Analysis

    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Explain this complex logic.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai explain this code block.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and explain its main purpose.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    @qodo-code-review
    Copy link
    Contributor

    Changelog updates: 🔄

    2025-05-23 *

    Added

    • Added Claude Code GitHub workflow for AI-assisted code improvements and reviews

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    @qodo-code-review
    Copy link
    Contributor

    qodo-code-review bot commented May 23, 2025

    PR Code Suggestions ✨

    Latest suggestions up to 97eb40a
    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Improve repository checkout depth

    When working with pull request comments, a deeper fetch depth is needed to
    access the full PR context. Increase the fetch-depth to ensure Claude has access
    to the necessary code history.

    .github/workflows/claude.yml [30-33]

     - name: Checkout repository
       uses: actions/checkout@v4
       with:
    -    fetch-depth: 1
    +    fetch-depth: 0
    • Apply / Chat
    Suggestion importance[1-10]: 6

    __

    Why: Increasing the fetch-depth to 0 ensures the workflow has access to the full repository history, which can be important for workflows that analyze PR context. This is a minor but useful improvement for reliability, though not critical.

    Low
    • Update

    Previous suggestions

    ✅ Suggestions up to commit af7cae1
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Add required write permissions
    Suggestion Impact:The commit implemented the exact permission changes suggested, changing pull-requests and issues from 'read' to 'write' permissions, which allows Claude to respond to comments instead of just reading them

    code diff:

    -      pull-requests: read
    -      issues: read
    +      pull-requests: write
    +      issues: write

    Add pull-requests: write and issues: write permissions to allow Claude to
    respond to comments. Currently, Claude can read issues and PRs but cannot post
    responses without write permissions.

    .github/workflows/claude.yml [21-25]

     permissions:
       contents: read
    -  pull-requests: read
    -  issues: read
    +  pull-requests: write
    +  issues: write
       id-token: write
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies that pull-requests: write and issues: write permissions are necessary for the workflow to allow Claude to post responses, not just read. This is a critical functional requirement for the workflow to operate as intended.

    Medium

    @qodo-code-review
    Copy link
    Contributor

    Manual-approval option for PR-Agent is disabled. You can enable it via a configuration file

    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 introduces a GitHub Actions workflow to enable the Claude Code AI integration by triggering on various comment and review events when @claude is mentioned.

    • Creates a claude.yml workflow that listens for issue comments, PR review comments, PR reviews, and issue open/assign events containing @claude.
    • Defines a job that checks out the repository and runs the anthropics/claude-code-action@beta.
    • Sets permissions and secrets needed for the action to execute.

    @codecov
    Copy link

    codecov bot commented May 23, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 100.00%. Comparing base (eb112d2) to head (97eb40a).
    Report is 1 commits behind head on main.

    Additional details and impacted files
    @@             Coverage Diff             @@
    ##                main       #46   +/-   ##
    ===========================================
      Coverage     100.00%   100.00%           
      Complexity        33        33           
    ===========================================
      Files              1         1           
      Lines             81        81           
    ===========================================
      Hits              81        81           

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    🚀 New features to boost your workflow:
    • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

    Copy link

    @coderabbitai coderabbitai bot left a comment

    Choose a reason for hiding this comment

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

    Actionable comments posted: 1

    🧹 Nitpick comments (3)
    .github/workflows/claude.yml (3)

    4-11: Refine event triggers for clarity
    The workflow triggers on issues.assigned, but assignment rarely includes @claude. Consider removing or documenting why you need the assigned event to avoid unexpected runs.


    15-19: Streamline the if condition
    The multi-line expression covers all comment and issue events, but you can collapse common checks (e.g. contains(github.event.comment.body, '@claude')) to reduce duplication and improve readability.


    27-31: Enhance checkout security
    To enforce immutable inputs and prevent token leakage, add persist-credentials: false unless the checkout step explicitly needs GITHUB_TOKEN for downstream operations.

     - uses: actions/checkout@v4
       with:
         fetch-depth: 1
    +    persist-credentials: false
    📜 Review details

    Configuration used: .coderabbit.yaml
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between eb112d2 and af7cae1.

    📒 Files selected for processing (1)
    • .github/workflows/claude.yml (1 hunks)
    ⏰ Context from checks skipped due to timeout of 90000ms (2)
    • GitHub Check: guardrails/scan
    • GitHub Check: Codacy Static Code Analysis
    🔇 Additional comments (1)
    .github/workflows/claude.yml (1)

    32-36: Verify secret configuration
    Ensure ANTHROPIC_API_KEY is defined in your repository secrets and scoped to authorized collaborators only.

    - Change pull-requests and issues permissions from read to write to allow Claude to respond
    - Add user restriction to only allow MarjovanLier to trigger Claude
    - Add repository check to prevent workflow tampering from forks
    - Prevent unauthorized API usage and costs
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    @qodo-code-review
    Copy link
    Contributor

    Changelog updates: 🔄

    2025-05-23 *

    Added

    • Added Claude Code GitHub workflow for AI-assisted development
    • Implemented security restrictions to control access to Claude assistant
    • Configured workflow to respond to @claude mentions in issues and PRs

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    @qodo-code-review
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Access Control

    The workflow is currently restricted to only run when triggered by the user 'MarjovanLier'. Consider whether this restriction is appropriate for your team's needs or if other team members should be able to use Claude.

    github.repository == 'MarjovanLier/StringManipulation' &&
    github.actor == 'MarjovanLier' && (
    Missing Tool Permissions

    The workflow doesn't specify any allowed tools for Claude to use. Consider whether you need to add specific tools like npm commands as mentioned in the PR description.

    id: claude
    uses: anthropics/claude-code-action@beta
    with:
      anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

    @qodo-code-review
    Copy link
    Contributor

    Manual-approval option for PR-Agent is disabled. You can enable it via a configuration file

    @MarjovanLier
    Copy link
    Owner Author

    @claude If you're being triggered, what do you think of this PR?

    @MarjovanLier MarjovanLier requested a review from Copilot May 23, 2025 20:09
    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 introduces a GitHub Actions workflow to integrate the Claude Code AI assistant into the repository.

    • Adds a workflow triggered by issue comments, pull request review comments, pull request reviews, and issues that mention @claude.
    • Includes security restrictions through actor and repository checks, and appropriate permission settings.

    @MarjovanLier MarjovanLier merged commit f7e2331 into main May 23, 2025
    12 checks passed
    @MarjovanLier MarjovanLier deleted the add-claude-github-actions-1748029083867 branch May 23, 2025 20:11
    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.

    2 participants