Skip to content

Instantly share code, notes, and snippets.

@hicay
Created January 25, 2026 16:49
Show Gist options
  • Select an option

  • Save hicay/fe46b3bf2442f6f9919c6f91d835c214 to your computer and use it in GitHub Desktop.

Select an option

Save hicay/fe46b3bf2442f6f9919c6f91d835c214 to your computer and use it in GitHub Desktop.
Auto Fix Bug with Claude
name: Auto Fix Bug with Claude
on:
issues:
types: [opened, labeled]
jobs:
auto-fix:
if: contains(github.event.issue.labels.*.name, 'bug')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Claude Code to Fix Bug
id: claude-fix
uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
allowed_bots: "sentry[bot]"
# model: "claude-opus-4-20250514" # Optional: defaults to Sonnet
direct_prompt: |
You are tasked with fixing a reported bug.
Issue Title: ${{ github.event.issue.title }}
Issue Description:
${{ github.event.issue.body }}
Instructions:
1. Analyze the issue description to understand the bug.
2. Explore the codebase to locate the relevant files.
3. Modify the code to fix the bug.
4. If possible, add a test case to prevent regression.
5. Verify your fix (e.g., run existing tests if applicable).
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "fix: resolve bug #${{ github.event.issue.number }}"
title: "fix: resolve bug #${{ github.event.issue.number }}"
body: |
Automated fix for issue #${{ github.event.issue.number }} by Claude Code.
Closes #${{ github.event.issue.number }}
branch: claude-fix/issue-${{ github.event.issue.number }}
base: main
delete-branch: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment