Skip to content

Claude Fix Failed Tests #14

Claude Fix Failed Tests

Claude Fix Failed Tests #14

name: Claude Fix Failed Tests
on:
workflow_run:
workflows: ["Tests"]
types: [completed]
jobs:
fix-tests:
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.head_branch != 'main' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 1
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: TestResults/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
The CI tests failed on branch ${{ github.event.workflow_run.head_branch }}.
1. Check TestResults/ for .trx files with failure details
2. If no artifacts, run: dotnet test src/SimSteward.Plugin.Tests/SimSteward.Plugin.Tests.csproj -c Release -v normal
3. Analyze the root cause of each failure
4. Fix the failing tests or the code they test
5. Verify fixes by running the tests again
Do NOT modify tests just to make them pass — fix the underlying code unless the test itself is wrong.