Skip to content

Commit 28fcee5

Browse files
committed
more
1 parent 1c446c4 commit 28fcee5

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/prompts/fix-pr-ci-failures.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Do not stop a given execution until you have worked through all phases below.
1717
3. Get the current branch name using `git branch --show-current`
1818
4. Find the PR for this branch using `gh pr list --head <branch-name> --json number,title` and extract the PR number
1919
5. Use `gh pr view <pr-number> --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion == "FAILURE") | {name: .name, detailsUrl: .detailsUrl, databaseId: .databaseId}'` to get the list of all failed CI jobs
20-
6. Check if there are actually CI failures to fix - if all jobs passed, exit early
20+
6. **Ignore aggregate/rollup checks** like `required-status-check` — they fail if and only if some real underlying check fails, so fixing the real checks resolves them automatically. Do not spend effort downloading their logs.
21+
7. Check if there are actually CI failures to fix - if all jobs passed (after filtering rollups), exit early
22+
8. **Trivial-failure fast path**: if there is exactly one failing job with an obvious single root cause (e.g., one markdownlint rule, one spotless violation, one known-flaky infra error), skip Phases 1-2 entirely — fix directly, validate, commit. The CI-PLAN.md / `.git/info/exclude` machinery is overhead for a 2-line fix.
2123

2224
## Phase 1: Gather Information
2325

@@ -48,7 +50,9 @@ rm -f CI-PLAN.md
4850
- **Flaky / infra failures**: if a failure looks like a network timeout, cache miss, runner OOM, or anything clearly unrelated to PR code, note it in `CI-PLAN.md` under "Notes" and do not invent a code fix for it.
4951
3. Download logs for the selected representatives. Two equally-valid options:
5052

51-
**Option A: `gh run view`** (avoids putting the token in process argv):
53+
**On Windows/Git Bash, default to Option B.** `gh run view --log-failed` is unreliable on that platform — it sometimes fails with `stream error: stream ID 1; CANCEL; received from peer`, and sometimes silently exits 0 while producing a 0-byte file. If you do try Option A, always verify the output is non-empty (`wc -l`) and fall back to Option B if it is empty.
54+
55+
**Option A: `gh run view`** (avoids putting the token in process argv; preferred on Linux/macOS):
5256

5357
```
5458
# For a single job's failing log only:
@@ -58,7 +62,7 @@ rm -f CI-PLAN.md
5862
gh run view <run-id> --log-failed > /tmp/run-<run-id>-failed.log
5963
```
6064

61-
**Option B: REST API**use this on Windows/Git Bash, where `gh run view --log-failed` often fails with `stream error: stream ID 1; CANCEL; received from peer`:
65+
**Option B: REST API**required on Windows/Git Bash:
6266

6367
```
6468
(cd /tmp && curl -sSfL \
@@ -139,14 +143,15 @@ Work through `CI-PLAN.md`, checking items off as you complete them. For each fai
139143
- Analyze the failure using the logs (now you may open source files).
140144
- Implement the fix.
141145
- Spotless failures: `./gradlew :<failed-module-path>:spotlessApply`
146+
- Markdown lint failures: most `markdownlint` rules have no auto-fix \u2014 edit manually. `mise run lint:markdown` only validates; there is no `lint:markdown:fix` task.
142147
- **Test locally before committing**:
143148
- Markdown lint: `mise run lint:markdown`
144149
- Compilation errors: `./gradlew <failed-task-path>`
145150
- Test failures: run the whole module's test task (e.g., `./gradlew :instrumentation:module-name:javaagent:test`) rather than just the single failing test — related tests in the module often need fixing too.
146151
- Verify the fix resolves the issue.
147152
- Update the checkbox in `CI-PLAN.md`.
148153
- Commit each logical fix as a **separate commit**:
149-
- Use explicit pathspecs: `git commit -- path/one path/two -m "..."`.
154+
- Use explicit pathspecs. **Put `-m` before `--`**, because everything after `--` is treated as a pathspec by git: `git commit -m "..." -- path/one path/two`.
150155
- Note that `git mv` auto-stages the rename — don't re-run `git add` on the moved paths.
151156
- If `git mv` or earlier edits have already staged unrelated changes, `git reset` first and stage only the files for the current logical fix.
152157
- Do not commit `CI-PLAN.md`.

0 commit comments

Comments
 (0)