Skip to content

Commit e72af31

Browse files
authored
Merge pull request #204 from netresearch/docs/ci-log-fetch-recipe
docs(git-workflow): fetch a failed job's log while the run is still live
2 parents 81c6f95 + 34b1646 commit e72af31

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

skills/git-workflow/references/ci-cd-integration.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,27 @@ ejections and one line — `[ERROR] Undefined constant …PHPUnitSetList::PHPUNI
129129
— that named the cause outright. The job-level calls had been tried first and
130130
showed nothing but setup.
131131

132+
**While the run is still in progress, the archive does not exist yet**
133+
`gh run view --log` answers `run … is still in progress; logs will be
134+
available when it is complete`, and so does the run-archive endpoint. A job
135+
that has already FAILED inside that running run is still readable through the
136+
job endpoint, with two traps: `gh api` refuses a body containing terminal
137+
escape sequences unless told otherwise, and the body arrives ANSI-colored:
138+
139+
```bash
140+
gh api "repos/$R/actions/jobs/$JOB/logs" --allow-escape-sequences \
141+
| sed 's/\x1b\[[0-9;]*m//g'
142+
```
143+
144+
Without the flag the only output is
145+
`the response contains terminal escape sequences; pass --allow-escape-sequences
146+
to output it anyway` — one line, exit 0, easy to mistake for an empty log.
147+
Measured on 2026-08-18 (a matrix leg had failed while the rest of the run was
148+
still executing): the job-level body carried the full PHPUnit failure, so "job
149+
logs show only preamble" (above) is a per-job lottery, not a law — try the job
150+
endpoint first while the run lives, fall back to the run archive once it is
151+
complete.
152+
132153
Note the archive is per *run*, so for a queue ejection you need the
133154
`gh-readonly-queue/*` run, not the pull request's own:
134155

0 commit comments

Comments
 (0)