Skip to content

Commit 9b8a74e

Browse files
author
Nick Sullivan
committed
🤖 Add automated CI failure fix workflow with Claude
Automatically detects failed CI runs and uses Claude to analyze and fix common issues like linting errors, test failures, and type errors. Reduces manual intervention and speeds up development workflow.
1 parent 6053a2b commit 9b8a74e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Claude Fix CI
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"] # Replace "CI" with your actual CI workflow name
6+
types: [completed]
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
jobs:
11+
fix-ci:
12+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
id-token: write
18+
actions: read
19+
20+
steps:
21+
- name: Checkout PR branch
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
ref: ${{ github.event.workflow_run.head_branch }}
26+
27+
- name: Run Claude Code to Fix CI Issues
28+
id: claude-fix
29+
uses: anthropics/claude-code-action@v1
30+
with:
31+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
32+
prompt: |
33+
This PR has failing CI checks. Please:
34+
35+
1. Examine the CI failures
36+
2. Fix the issues (linting errors, test failures, type errors, etc.)
37+
3. Commit the fixes with a clear message
38+
39+
Use the project's coding standards from .cursor/rules/ if available.
40+
Run tests to verify fixes work before committing.
41+
42+
claude_args: '--permission-mode bypassPermissions --allowed-tools "Bash(*),Read(*),Write(*),Edit(*)"'
43+
44+
- name: Push fixes if any were made
45+
run: |
46+
if git diff --quiet; then
47+
echo "No changes made"
48+
else
49+
git push
50+
echo "Pushed fixes to PR"
51+
fi

0 commit comments

Comments
 (0)