From af0a7054c725279cf601cc10122dd8fa4be8dfbe Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Wed, 22 Apr 2026 08:55:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20auto-issue-fix=20G?= =?UTF-8?q?itHub=20Action=EF=BC=8Cai-fix=20=E6=A0=87=E7=AD=BE=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E8=87=AA=E5=8A=A8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- .github/workflows/auto-issue-fix.yml | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/auto-issue-fix.yml diff --git a/.github/workflows/auto-issue-fix.yml b/.github/workflows/auto-issue-fix.yml new file mode 100644 index 000000000..4bfeb1d82 --- /dev/null +++ b/.github/workflows/auto-issue-fix.yml @@ -0,0 +1,59 @@ +name: Auto Issue Fix + +on: + issues: + types: [labeled] + +jobs: + auto-fix: + # Only trigger when the label is "ai-fix" + if: github.event.label.name == 'ai-fix' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} + prompt: | + You are an expert software engineer. Analyze the following GitHub issue and determine if it can be fixed. + + Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }} + ${{ github.event.issue.body }} + + Instructions: + 1. Read and understand the issue thoroughly. + 2. Explore the codebase to find the relevant code. + 3. If the issue is fixable, implement the fix and create a pull request. Use a clear PR title and description referencing the issue. + 4. If the issue is NOT fixable (e.g., needs more info, not a bug, out of scope), explain why in a brief summary. + 5. At the end, output a summary of what you did as your FINAL message. This will be posted as a comment on the issue. + claude_args: | + --model ${{ vars.CLAUDE_MODEL || 'claude-sonnet-4-20250514' }} + --max-turns 30 + --allowedTools "Edit,Write,Read,Bash,Glob,Grep,Agent" + settings: > + { + "env": { + "ANTHROPIC_BASE_URL": "${{ secrets.ANTHROPIC_BASE_URL }}" + } + } + + - name: Post Claude's response as issue comment + if: always() && steps.claude.outputs.result != '' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh issue comment ${{ github.event.issue.number }} --body "${{ steps.claude.outputs.result }}"