Skip to content

Commit b284edd

Browse files
captbaritonemeta-codesync[bot]
authored andcommitted
Add Claude command to automate fixing github ci (#5129)
Summary: Now you can open Calude in the Relay repo and run `/fix-ci` to have Claude attempt to fix any CI issues. Example PR created with this command: #5128 Pull Request resolved: #5129 Reviewed By: evanyeung Differential Revision: D90196913 Pulled By: captbaritone fbshipit-source-id: 817dcda33cb17b4fdea6efc2d4c98d645208a75a
1 parent b4b17c0 commit b284edd

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.claude/commands/fix-ci.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Fix CI Skill
2+
3+
You are a specialized skill for checking GitHub CI status and fixing failing tests in the Relay project.
4+
5+
## Your Task
6+
7+
1. **Check Current CI Status**
8+
- Use `gh run list --branch=main --workflow=ci.yml --limit 5` to see recent workflow runs
9+
- If the most recent run is failing, use `gh run view <ID>` using the ID from the most recent run to get detailed status
10+
- Identify any failing jobs or checks
11+
12+
2. **Analyze Failures**
13+
- For each failing job, use `gh run view <run-id> --log-failed` to get failure logs
14+
- **Note**: If this command has no output, you may need to upgrade `gh`. See https://github.com/cli/cli/issues/10551.
15+
- Parse the logs to identify the specific test failures or errors
16+
17+
3. **Fix the Issues**
18+
- Based on the failure type, take appropriate action:
19+
- See `CONTRIBUTING.md` for instructions on how to work in this repository.
20+
21+
4. **Create a Pull Request**
22+
- Create a new branch: `git checkout -b fix-ci-failures-$(date +%Y%m%d-%H%M%S)`
23+
- Stage all changes: `git add .`
24+
- Commit with descriptive message about what was fixed
25+
- Push the branch: `git push -u origin HEAD`
26+
- Create PR using `gh pr create` with:
27+
- Title: "Fix CI failures - [Brief description]"
28+
- Body: Detailed explanation of:
29+
- Which jobs were failing
30+
- What the errors were
31+
- How you fixed them
32+
- Test results showing the fixes work
33+
34+
5. **Monitor PR and Iterate Until Passing**
35+
- After creating the PR, monitor the CI status in a loop
36+
- Use `gh run list --branch=<your-branch> --limit 1` to check the latest run
37+
- Use `gh run view <run-id>` to check if it's completed and its status
38+
- If the run is still in progress, wait 30 seconds and check again
39+
- If the run fails:
40+
- Use `gh run view <run-id> --log-failed` to get failure logs
41+
- Analyze the new failures (they may be different from the original ones)
42+
- Fix the issues following the same process as step 3
43+
- Commit and push the fixes: `git add . && git commit -m "Fix additional CI failures" && git push`
44+
- Continue monitoring the new CI run
45+
- Keep iterating until all CI checks pass
46+
- Report success when all checks are green
47+
48+
## Important Guidelines
49+
50+
- Always verify fixes locally before creating a PR
51+
- If you can't automatically fix an issue, document it clearly in your response
52+
- Check if there are multiple failures - fix all of them in one PR if possible
53+
- Run the relevant test suite locally before pushing
54+
- Make sure your fixes don't introduce new issues
55+
- If CI is passing, report that and don't create unnecessary PRs
56+
57+
## Example Workflow
58+
59+
```bash
60+
# 1. Check CI status
61+
gh run list --branch=main --workflow=ci.yml --limit 5
62+
63+
# 2. Get details of latest run
64+
gh run view 20949129659 --log-failed
65+
66+
# 3. If JS tests are failing, run locally
67+
yarn run jest <failing-test>
68+
69+
# 4. Fix the code
70+
# (Read files, make edits)
71+
72+
# 5. Verify fix
73+
yarn run jest <failing-test>
74+
75+
# 6. Create PR
76+
git checkout -b fix-ci-failures-20260106
77+
git add .
78+
git commit -m "Fix failing jest tests in MockPayloadGenerator"
79+
git push -u origin HEAD
80+
gh pr create --title "Fix CI: MockPayloadGenerator test failures" --body "..."
81+
```
82+
83+
## Start Here
84+
85+
Begin by checking the current CI status and reporting what you find.

0 commit comments

Comments
 (0)