Skip to content

Add Claude Code GitHub Workflow#73

Open
B4r70 wants to merge 2 commits intomainfrom
add-claude-github-actions-1772646772695
Open

Add Claude Code GitHub Workflow#73
B4r70 wants to merge 2 commits intomainfrom
add-claude-github-actions-1772646772695

Conversation

@B4r70
Copy link
Owner

@B4r70 B4r70 commented Mar 4, 2026

🤖 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!

Summary by Sourcery

GitHub Actions-Workflows hinzufügen, um Claude-Code-Interaktionen und automatisierte, KI-gestützte Code-Reviews für Pull Requests zu ermöglichen.

Neue Features:

  • Einführung eines Claude-Code-Workflows, der auf @claude-Erwähnungen in Issues, Kommentaren und Reviews reagiert.
  • Hinzufügen eines automatisierten Claude-Code-Review-Workflows, der KI-gestützte Reviews bei Pull Requests ausführt.

Build:

  • GitHub Actions so konfigurieren, dass sie mithilfe des Anthropic-API-Schlüssels des Repositorys in anthropics/claude-code-action integriert werden.
Original summary in English

Summary by Sourcery

Add GitHub Actions workflows to enable Claude Code interactions and automated AI-assisted code reviews on pull requests.

New Features:

  • Introduce a Claude Code workflow that responds to @claude mentions in issues, comments, and reviews.
  • Add an automated Claude Code Review workflow that runs AI-powered reviews on pull requests.

Build:

  • Configure GitHub Actions to integrate with the anthropics/claude-code-action using the repository's Anthropic API key.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 4, 2026

Reviewer's Guide

Fügt zwei GitHub-Actions-Workflows hinzu, um Claude Code in das Repository zu integrieren: einen für Interaktionen nach Bedarf über @claude-Erwähnungen in Issues/PRs und einen weiteren, der automatisch Claude Code Review bei Pull-Request-Ereignissen ausführt.

Sequenzdiagramm für den On-Demand-Claude-Code-Workflow via @claude-Erwähnungen

sequenceDiagram
  actor Developer
  participant GitHub
  participant Workflow_claude
  participant Job_claude
  participant Claude_Code_Action
  participant Anthropic_API

  Developer->>GitHub: Create issue/PR or comment with @claude
  GitHub-->>Workflow_claude: Trigger issue/PR/comment event
  Workflow_claude->>Workflow_claude: Evaluate @claude condition
  alt Condition_matches
    Workflow_claude-->>Job_claude: Start job claude
    Job_claude->>Claude_Code_Action: Run anthropics/claude-code-action@v1
    Claude_Code_Action->>Anthropic_API: Call Anthropic with ANTHROPIC_API_KEY
    Anthropic_API-->>Claude_Code_Action: Analysis and instructions
    Claude_Code_Action->>GitHub: Read/write files, create comments, branches, commits
  else No_match
    Workflow_claude-->>GitHub: No Claude job started
  end
Loading

Sequenzdiagramm für den automatischen Claude-Code-Review-Workflow

sequenceDiagram
  actor Developer
  participant GitHub
  participant Workflow_claude_code_review
  participant Job_claude_review
  participant Claude_Code_Action
  participant Anthropic_API

  Developer->>GitHub: Open/update PR (opened, synchronize, ready_for_review, reopened)
  GitHub-->>Workflow_claude_code_review: Trigger pull_request event
  Workflow_claude_code_review-->>Job_claude_review: Start job claude-review
  Job_claude_review->>Claude_Code_Action: Run anthropics/claude-code-action@v1
  Claude_Code_Action->>Anthropic_API: Call Anthropic with ANTHROPIC_API_KEY
  Claude_Code_Action->>Anthropic_API: Execute code-review plugin via prompt
  Anthropic_API-->>Claude_Code_Action: Review results
  Claude_Code_Action->>GitHub: Post review comments or summaries on PR
Loading

Änderungen auf Dateiebene

Change Details Files
Einführung eines GitHub-Actions-Workflows, um Claude Code auszuführen, wenn @claude in Issues oder Pull-Request-Kontexten erwähnt wird.
  • Konfiguriert Trigger für Issue-Kommentare, PR-Review-Kommentare, PR-Reviews und Issue-Ereignisse, um nach @claude-Erwähnungen in Bodies/Titeln zu lauschen.
  • Steuert den Job mit einem zusammengesetzten Bedingungsausdruck, der den Ereignistyp und das Vorhandensein von @claude im entsprechenden Payload-Feld prüft.
  • Läuft auf ubuntu-latest mit minimalen Leseberechtigungen plus id-token: write und actions: read, damit Claude CI-Ergebnisse prüfen kann.
  • Checkt das Repository mit flachem Fetch aus und ruft anthropics/claude-code-action@v1 unter Verwendung des Anthropic-API-Schlüssels aus GitHub Secrets auf, mit auskommentierten Beispielen für zusätzliche Berechtigungen, Prompts und claude_args-Anpassungen.
.github/workflows/claude.yml
Einführung eines automatisierten Claude-Code-Review-Workflows, der bei Pull-Request-Lifecycle-Ereignissen ausgeführt wird.
  • Trigger auf pull_request-Ereignisse (opened, synchronize, ready_for_review, reopened) mit auskommentierten Beispielen für pfadbasierte Filterung.
  • Definiert einen claude-review-Job mit ubuntu-latest-Runner und nur-Lesen-Berechtigungen für contents, pull-requests, issues sowie id-token: write.
  • Checkt das Repository mit flachem Clone aus und ruft anthropics/claude-code-action@v1 auf, konfiguriert zum Laden des Code-Review-Plugins aus dem Claude-Code-Plugin-Marktplatz.
  • Ruft das Code-Review-Plugin mit einem Prompt auf, der auf den aktuellen PR nach Repository und Pull-Request-Nummer abzielt, mit Kommentaren, die auf Dokumentation für weitere claude_args-Anpassungen verweisen.
.github/workflows/claude-code-review.yml

Tipps und Befehle

Interaktion mit Sourcery

  • Neue Review auslösen: Kommentiere @sourcery-ai review im Pull Request.
  • Diskussionen fortsetzen: Antworte direkt auf Sourcerys Review-Kommentare.
  • GitHub-Issue aus einem Review-Kommentar erzeugen: Bitte Sourcery, ein Issue aus einem Review-Kommentar zu erstellen, indem du darauf antwortest. Du kannst auch auf einen Review-Kommentar mit @sourcery-ai issue antworten, um daraus ein Issue zu erstellen.
  • Pull-Request-Titel generieren: Schreibe @sourcery-ai irgendwo in den Pull-Request-Titel, um jederzeit einen Titel zu generieren. Du kannst auch @sourcery-ai title im Pull Request kommentieren, um den Titel jederzeit (neu) zu generieren.
  • Pull-Request-Zusammenfassung generieren: Schreibe @sourcery-ai summary irgendwo in den Pull-Request-Body, um jederzeit genau an der gewünschten Stelle eine PR-Zusammenfassung zu generieren. Du kannst auch @sourcery-ai summary im Pull Request kommentieren, um die Zusammenfassung jederzeit (neu) zu generieren.
  • Reviewer's Guide generieren: Kommentiere @sourcery-ai guide im Pull Request, um den Reviewer's Guide jederzeit (neu) zu generieren.
  • Alle Sourcery-Kommentare auflösen: Kommentiere @sourcery-ai resolve im Pull Request, um alle Sourcery-Kommentare aufzulösen. Nützlich, wenn du bereits alle Kommentare bearbeitet hast und sie nicht mehr sehen möchtest.
  • Alle Sourcery-Reviews verwerfen: Kommentiere @sourcery-ai dismiss im Pull Request, um alle bestehenden Sourcery-Reviews zu verwerfen. Besonders nützlich, wenn du mit einer neuen Review frisch starten möchtest – vergiss nicht, @sourcery-ai review zu kommentieren, um eine neue Review auszulösen!

Dein Erlebnis anpassen

Rufe dein Dashboard auf, um:

  • Review-Features wie die von Sourcery generierte Pull-Request-Zusammenfassung, den Reviewer's Guide und andere zu aktivieren oder zu deaktivieren.
  • Die Reviewsprache zu ändern.
  • Benutzerdefinierte Review-Anweisungen hinzuzufügen, zu entfernen oder zu bearbeiten.
  • Weitere Review-Einstellungen anzupassen.

Hilfe erhalten

Original review guide in English

Reviewer's Guide

Adds two GitHub Actions workflows to integrate Claude Code into the repository: one for on-demand interactions via @claude mentions on issues/PRs, and another that automatically runs Claude Code Review on pull request events.

Sequence diagram for on-demand Claude Code workflow via @claude mentions

sequenceDiagram
  actor Developer
  participant GitHub
  participant Workflow_claude
  participant Job_claude
  participant Claude_Code_Action
  participant Anthropic_API

  Developer->>GitHub: Create issue/PR or comment with @claude
  GitHub-->>Workflow_claude: Trigger issue/PR/comment event
  Workflow_claude->>Workflow_claude: Evaluate @claude condition
  alt Condition_matches
    Workflow_claude-->>Job_claude: Start job claude
    Job_claude->>Claude_Code_Action: Run anthropics/claude-code-action@v1
    Claude_Code_Action->>Anthropic_API: Call Anthropic with ANTHROPIC_API_KEY
    Anthropic_API-->>Claude_Code_Action: Analysis and instructions
    Claude_Code_Action->>GitHub: Read/write files, create comments, branches, commits
  else No_match
    Workflow_claude-->>GitHub: No Claude job started
  end
Loading

Sequence diagram for automatic Claude Code Review workflow

sequenceDiagram
  actor Developer
  participant GitHub
  participant Workflow_claude_code_review
  participant Job_claude_review
  participant Claude_Code_Action
  participant Anthropic_API

  Developer->>GitHub: Open/update PR (opened, synchronize, ready_for_review, reopened)
  GitHub-->>Workflow_claude_code_review: Trigger pull_request event
  Workflow_claude_code_review-->>Job_claude_review: Start job claude-review
  Job_claude_review->>Claude_Code_Action: Run anthropics/claude-code-action@v1
  Claude_Code_Action->>Anthropic_API: Call Anthropic with ANTHROPIC_API_KEY
  Claude_Code_Action->>Anthropic_API: Execute code-review plugin via prompt
  Anthropic_API-->>Claude_Code_Action: Review results
  Claude_Code_Action->>GitHub: Post review comments or summaries on PR
Loading

File-Level Changes

Change Details Files
Introduce GitHub Actions workflow to run Claude Code when @claude is mentioned in issues or pull request contexts.
  • Configure triggers on issue comments, PR review comments, PR reviews, and issue events to listen for @claude mentions in bodies/titles.
  • Gate the job with a composite conditional expression that checks event type and presence of @claude in the relevant payload field.
  • Run on ubuntu-latest with minimal read permissions plus id-token: write and actions: read so Claude can inspect CI results.
  • Check out the repository with shallow fetch and invoke anthropics/claude-code-action@v1 using the Anthropic API key from GitHub Secrets, with commented examples for additional permissions, prompts, and claude_args customization.
.github/workflows/claude.yml
Introduce an automated Claude Code Review workflow that runs on pull request lifecycle events.
  • Trigger on pull_request events (opened, synchronize, ready_for_review, reopened) with commented-out examples for path-based filtering.
  • Define a claude-review job with ubuntu-latest runner and read-only permissions for contents, pull-requests, issues, plus id-token: write.
  • Check out the repository with shallow clone and call anthropics/claude-code-action@v1 configured to load the code-review plugin from the Claude Code plugin marketplace.
  • Invoke the code-review plugin with a prompt that targets the current PR by repository and pull request number, with comments pointing to documentation for further claude_args customization.
.github/workflows/claude-code-review.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey – ich habe etwas übergeordnetes Feedback hinterlassen:

  • In .github/workflows/claude.yml ist actions: read bereits in den Job-Berechtigungen gewährt. Derselbe Scope in additional_permissions wirkt daher redundant und könnte entfernt werden, es sei denn, du möchtest ihn ausdrücklich als Beispiel demonstrieren.
Prompt für KI-Agenten
Bitte gehe auf die Kommentare aus diesem Code-Review ein:

## Allgemeine Kommentare
- In `.github/workflows/claude.yml` ist `actions: read` bereits in den Job-Berechtigungen gewährt. Derselbe Scope in `additional_permissions` wirkt daher redundant und könnte entfernt werden, es sei denn, du möchtest ihn ausdrücklich als Beispiel demonstrieren.

Sourcery ist für Open Source kostenlos – wenn dir unsere Reviews gefallen, teile sie gern ✨
Hilf mir, nützlicher zu sein! Bitte klicke bei jedem Kommentar auf 👍 oder 👎, und ich werde dein Feedback nutzen, um deine Reviews zu verbessern.
Original comment in English

Hey - I've left some high level feedback:

  • In .github/workflows/claude.yml, actions: read is already granted in the job permissions, so the same scope in additional_permissions appears redundant and could be removed unless you specifically need to demonstrate it as an example.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `.github/workflows/claude.yml`, `actions: read` is already granted in the job permissions, so the same scope in `additional_permissions` appears redundant and could be removed unless you specifically need to demonstrate it as an example.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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