Would you like to supercharge your dev workflow with AI? Meet the Claude Code Github Action, a game-changer that brings Anthropic’s Claude AI into your GitHub repos. Just drop an @claude
mention in a pull request or issue, and boom—Claude whips up code, fixes bugs, or refactors like a pro, all via Github Actions. I set this up in 15 minutes, and it’s mind-blowingly efficient! In this tutorial, I’ll guide you through installing the Claude Code Github Action, setting it up, and using it to automate your coding tasks. Ready to let AI do the heavy lifting? Let’s dive in!
Why Claude Code Github Action Rocks
The Claude Code Github Action is like having a genius coder on your team, 24/7. Built on Anthropic’s Claude AI, it listens for @claude
mentions in your repo and springs into action, powered by Github Actions. Here’s why it’s awesome:
- Instant Pull Requests: Describe a feature, and Claude creates a PR with all changes.
- Bug Fixes on Autopilot: Report a bug, and Claude codes the fix—no manual work needed.
- Code Consistency: Follows your project’s style (e.g., via
CLAUDE.md
) for clean, uniform code. - Secure and Private: Runs on your GitHub runners, keeping your code safe.
- Quick Setup: Up and running in minutes with minimal config.
The GitHub repo boasts a slick workflow, and I saw it churn out a refactored function in seconds. Let’s get it running!

How Claude Code Github Action Works
Claude Code hooks into Github Actions to monitor your repo for @claude
mentions in issues, pull requests, or review comments. When triggered, it:
- Analyzes your codebase or issue context.
- Generates or tweaks code based on your request.
- Creates a pull request with changes or posts feedback.
- Runs multiple Claude agents in parallel for speed.
It’s like having a coding buddy who never sleeps, all powered by Github Actions runners. Ready to set it up? Here’s how!
Step-by-Step Setup: Claude Code Github Action
Let’s get Claude Code running in your repo. I tested this on a Node.js project, but it works for any codebase. Follow these steps to automate your workflow in ~15 minutes.
1. Install the Claude GitHub App
You’ll need admin rights for your repo.
- Head to the Claude GitHub App page.
- Install it on your repository or organization, granting permissions for contents, issues, and pull requests.
- I installed it on my test repo, and it took 2 minutes—smooth!

2. Add Your Anthropic API Key
Claude needs an API key to work its magic.
- Go to your repo’s Settings > Secrets and variables > Actions.
- Click New repository secret.
- Name it
ANTHROPIC_API_KEY
and paste your Anthropic API key (get one from console.anthropic.com). - This keeps your key secure for Github Actions workflows.
3. Add the Claude Workflow File
Now, let’s set up the Github Actions workflow.
- Copy the example
claude.yml
from grll/claude-code-action. - Create a
.github/workflows/
folder in your repo. - Paste the following into
.github/workflows/claude.yml
:
# .github/workflows/claude.yml
name: Claude PR Assistant
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude-code-action:
if: |
(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'))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude PR Action
uses: grll/claude-code-action@beta
with:
use_oauth: true
claude_access_token: ${{ secrets.CLAUDE_ACCESS_TOKEN }}
claude_refresh_token: ${{ secrets.CLAUDE_REFRESH_TOKEN }}
claude_expires_at: ${{ secrets.CLAUDE_EXPIRES_AT }}
timeout_minutes: "60"
# Optional: add custom trigger phrase (default: @claude)
# trigger_phrase: "/claude"
# Optional: add assignee trigger for issues
# assignee_trigger: "claude"
# Optional: add custom environment variables (YAML format)
# claude_env: |
# NODE_ENV: test
# DEBUG: true
# API_URL: https://api.example.com
- This workflow listens for
@claude
in comments or issues and runs Claude on Github Actions runners.
4. Configure GitHub App Secrets
For the workflow to generate app tokens:
- Get your GitHub App’s
APP_ID
andAPP_PRIVATE_KEY
from the app’s settings (post-installation). - Add them as secrets in Settings > Secrets and variables > Actions:
APP_ID
: Your GitHub App ID.APP_PRIVATE_KEY
: The private key file content.
5. Trigger Claude with @claude
Now, test it out!
- Open an issue or comment on a PR with something like:
@claude Please refactor the data fetching logic in `api.js` for better error handling.
- Claude analyzes your request, creates a PR with the refactored code, and adds feedback.
- I tried this, and Claude delivered a cleaner
api.js
with try-catch blocks in a flash!

Customizing Claude Code Github Action
Want to tweak Claude’s behavior? The Github Actions workflow is super flexible. Here’s how to make it your own:
- Custom Prompts: Add a
CLAUDE.md
file with project guidelines (e.g., “Use async/await, avoid console.log”). Claude follows it like a style guide. - Timeouts: Adjust
timeout_minutes
inclaude.yml
(e.g.,"30"
for shorter runs). - Model Selection: Swap models in the workflow (e.g.,
claude-3-5-sonnet
instead ofclaude-3-7-sonnet
). - Authentication: Use AWS Bedrock or Google Vertex AI by updating
use_vertex
and environment variables. - Tool Access: Limit Claude’s file operations or GitHub API calls via workflow settings for extra security.
I added a CLAUDE.md
with “prefer TypeScript,” and Claude’s PRs matched my style perfectly!
Real-World Use Cases: Claude Code in Action
Claude Code shines in speeding up dev tasks. Here’s what I tried and what you can do with Github Actions:
- Bug Fixes: Posted an issue: “@claude Fix the null error in
user.js
.” Claude created a PR with a null check—done in 2 minutes! - Feature Building: Commented: “@claude Add a login endpoint to
server.js
.” Got a PR with Express routes and JWT auth. - Code Refactoring: Asked: “@claude Optimize
utils.js
for performance.” Claude rewrote loops and cached results. - Code Reviews: Claude reviewed my PR, suggesting better variable names and error handling.

Tips for Mastering Claude Code Github Action
To get the most out of Claude Code with Github Actions:
- Be Specific: Write clear
@claude
comments (e.g., “Add error handling tofetchData
inapi.js
”). - Use CLAUDE.md: Define coding standards (e.g., tabs vs. spaces, function naming) for consistent output.
- Monitor Runs: Check Actions tab in GitHub to debug workflows or view Claude’s logs.
- Combine with VS Code: Pair with Anthropic’s VS Code extension for local Claude coding, syncing with Github Actions.
- Test Small: Start with simple tasks (e.g., “@claude Add a README”) to learn Claude’s style.
I found that detailed prompts cut Claude’s response time by half—precision pays off!
Why Claude Code Github Action Stands Out
The Claude Code Github Action is a productivity beast. It’s faster than manual coding, respects your project’s style, and runs securely on Github Actions runners. Compared to other AI tools, Claude’s ability to create full PRs from a single comment is unmatched. The setup is quick, and the GitHub integration feels native. Minor hiccup: complex tasks may need prompt tweaking, but the repo’s examples help.
Whether you’re a solo dev or on a team, Claude Code makes coding feel like magic. Be sure to give it a spin!