|
| 1 | +name: Auto Fix Issue |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + issue_number: |
| 9 | + description: 'Issue number (e.g., 1234)' |
| 10 | + required: true |
| 11 | + type: number |
| 12 | + |
| 13 | +# Per-issue concurrency to prevent duplicate analysis |
| 14 | +concurrency: |
| 15 | + group: auto-fix-issue-${{ github.event.issue.number || github.event.inputs.issue_number }} |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +jobs: |
| 19 | + auto-fix-issue: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + issues: read |
| 24 | + pull-requests: write |
| 25 | + id-token: write |
| 26 | + # Run automatically for Flaky Test issues |
| 27 | + if: | |
| 28 | + github.event_name == 'workflow_dispatch' || |
| 29 | + contains(github.event.issue.labels.*.name, 'Flaky Test') |
| 30 | +
|
| 31 | + steps: |
| 32 | + - name: Parse issue number |
| 33 | + id: parse-issue |
| 34 | + env: |
| 35 | + EVENT_NAME: ${{ github.event_name }} |
| 36 | + EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }} |
| 37 | + INPUT_ISSUE_NUMBER: ${{ github.event.inputs.issue_number }} |
| 38 | + run: | |
| 39 | + if [ "$EVENT_NAME" = "issues" ]; then |
| 40 | + ISSUE_NUM="$EVENT_ISSUE_NUMBER" |
| 41 | + else |
| 42 | + ISSUE_NUM="$INPUT_ISSUE_NUMBER" |
| 43 | + fi |
| 44 | +
|
| 45 | + echo "issue_number=$ISSUE_NUM" >> "$GITHUB_OUTPUT" |
| 46 | + echo "Processing issue #$ISSUE_NUM in CI mode" |
| 47 | +
|
| 48 | + - name: Checkout repository |
| 49 | + uses: actions/checkout@v6 |
| 50 | + with: |
| 51 | + ref: develop |
| 52 | + |
| 53 | + - name: Try to fix the issue with Claude |
| 54 | + id: triage |
| 55 | + uses: anthropics/claude-code-action@v1 |
| 56 | + with: |
| 57 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 58 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + allowed_non_write_users: '*' |
| 60 | + prompt: | |
| 61 | + Fix the issue in getsentry/sentry-javascript with number #{{ steps.parse-issue.outputs.issue_number }}. |
| 62 | + Follow the steps below to fix the issue: |
| 63 | + 1. Identify the root cause of the issue |
| 64 | + 2. Propose a fix for the issue |
| 65 | + 3. Verify the fix is small |
| 66 | + 4a. IMPORTANT: If the fix is complicated, or you are not 100% sure about the fix, stop here and instead write a comment on the issue describring what you did so far and why you aborted creating a fix. |
| 67 | + 4b. Else, implement the fix |
| 68 | + 5. Test the fix |
| 69 | + 6. Commit the fix |
| 70 | + 7. Create a pull request for the fix |
0 commit comments