Bright Labs

How to see the failed attempt after you re-run a GitHub Actions job

You re-ran a failed job, it turned green, and the red attempt seems to have vanished from the page. It hasn't. On the run's page, open the Latest dropdown to the right of the run name and click a previous run attempt. From a terminal, gh run view takes an --attempt flag, and the REST API has endpoints for a single attempt and its logs.

Below is how to find each one. After that: why a downloaded log archive can be missing jobs, and what the failed attempt can tell you before you merge.

Why the failed attempt seems to disappear

A re-run doesn't give you a new run. GitHub's contexts reference says of github.run_id: "This number does not change if you re-run the workflow run." What changes is the attempt number.

github.run_attempt is described as "A unique number for each attempt of a particular workflow run in a repository." It increments with each re-run. In short: same run, new attempt. The older attempts are one dropdown away.

The re-run also uses the same commit. GitHub's re-run docs say the workflow will use the same GITHUB_SHA (commit SHA). So a red attempt and a green attempt in one run are two tries at the same commit. Keep that in mind, because it's the part that matters later.

Open an earlier attempt in the browser

Here's what to check first: switch between the failed attempt and the latest one, and compare the failing step side by side. If the error text is a timeout, a network error or a race in a test you didn't touch, that's a different story from an assertion in code your pull request changed.

Download the full set of logs after a partial re-run

Here's the catch with re-running only some jobs. GitHub's log docs say: "When you download the log archive for a workflow that was partially re-run, the archive only includes the jobs that were re-run." The jobs that weren't re-run aren't in it.

That follows from how partial re-runs work. When you re-run failed jobs or a specific job, GitHub also re-runs the jobs that depend on them. The jobs left out keep their outputs from the previous attempt, which the newly run jobs can use. They don't run again, so they have no new log.

To get everything, the docs say you must download the log archives for the previous run attempts that ran the other jobs. In practice:

Earlier attempts from the GitHub CLI

The gh run view manual has an example for exactly this:

From the gh run view manual
gh run view 12345 --attempt 3
gh run view flags for reading attempts and logs, as the manual describes them
FlagWhat the manual says
--attemptThe attempt number of the workflow run
--logView full log for either a run or specific job
--log-failedView the log for any failed steps in a run or specific job
--jobView a specific job ID from a run

For one job's full log, the manual gives this example:

From the gh run view manual
gh run view --log --job 456789

Earlier attempts from the REST API

If you script this, the workflow runs API has an endpoint for one attempt and one for that attempt's logs. The attempt_number parameter is described as "The attempt number of the workflow run."

From GitHub's REST API docs for workflow runs and workflow jobs
/repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}
/repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs

What the failed attempt tells you

Once you can see both attempts, you have a useful fact: this job failed and then passed on the same commit. Treat that as a hint the job may be flaky. It isn't proof the failure is harmless. Read the failed step's log, and if the error touches code your pull request changed, treat it as real.

One time is a hint. A pattern across many commits is stronger evidence. Checking that by hand means opening attempt after attempt on run after run. If you want that count on the pull request itself, we make FlakeRadar, a free Chrome extension. It reads the repository's own GitHub Actions history and counts a job as flaky when it failed and then passed on the same commit. Each failing check gets a label (Known flake, New failure, Also failing on the default branch, or Not enough history) with counts, a time window and a date. It only analyses GitHub Actions checks, and a Known flake label is evidence, not a promise.

Limits to know before you re-run again

Sources

Questions

Does re-running a job delete the failed attempt?

No. The earlier attempt stays on the run. To the right of the run name, select the Latest dropdown menu and click a previous run attempt.

Does a re-run test the same commit?

Yes. GitHub's re-run docs say the workflow uses the same GITHUB_SHA (commit SHA). To test a fix you pushed, let the new commit's checks run.

Why is my downloaded log archive missing jobs?

When you download the log archive for a workflow that was partially re-run, the archive only includes the jobs that were re-run. Switch to the earlier attempt and download its archive too.

Can a workflow tell which attempt it is on?

Yes. Read github.run_attempt. It increments with each re-run, while github.run_id stays the same.

Related