Sub topic 2
From a red check to the failing step
This chapter covers the path from a failed check on a commit or pull request to the exact step that failed. It assumes you can read YAML, know what a commit and a pull request are, and have a repository with a workflow that has run at least once.
Start at the red check
A failed workflow shows a red X in three common places: next to a commit in the commit list, in the checks section at the bottom of a pull request, and in the Actions tab. Each one leads to the same run page, but the Actions tab is the most direct.
- Open the Actions tab of the repository.
- In the left sidebar, pick the workflow by name. Skip this to see runs from all workflows.
- Find the run with the red X. The run title is the commit message or pull request title. The line below it shows the event, such as
pushorpull_request, and the branch. - Click the run.
From a pull request, click Details next to the failed check. That link goes straight to the failing job, so you skip the run overview.
The run page
The run page has three areas.
- The summary at the top shows the trigger, the status, and the total duration. It also lists annotations, which later chapters cover.
- The jobs list on the left shows each job with a status icon. A red X means the job failed. A grey circle with a slash means it was skipped or cancelled.
- The graph in the middle shows how jobs depend on each other through
needs.
Look at the jobs list first. If several jobs are red, start with the one that has no failed dependency. A job that depends on a failed job through needs is skipped and shows grey, so the red job is the one that actually broke.
Open the failed job
Click the failed job name. The right side shows every step in the job, in order. Each step has an icon:
| Icon | Meaning |
|---|---|
| Green check | The step finished with exit code 0. |
| Red X | The step failed. |
| Grey circle with a slash | The step was skipped, usually because an earlier step failed. |
GitHub expands the first failed step for you in most cases. If it does not, click the step name to expand it.
Consider this workflow, which is the baseline used throughout this tutorial.
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm testSuppose package.json is in a subdirectory named app/. The job page then shows the first two steps green, npm ci red, and npm test grey. The grey step did not run, so it holds no useful information. The red step is where to read.
GitHub also adds a few steps you did not write. Set up job appears first and Complete job appears last. Your own steps sit between them. Their names come from the name: key, or from the uses: or run: value when no name is given. Unnamed steps are harder to scan, so a short name: on each step helps.
What to note before reading the log
Before you read any output, write down three facts:
- Which job failed.
- Which step failed.
- Which event and branch triggered the run.
The event matters because a pull_request run and a push run can behave differently, for example in which secrets they can read. If a failure seems odd, compare it with an earlier green run of the same workflow. The sidebar lets you filter by branch, so you can find the last passing run and see what changed.
Re-run and download options
The top right of the run page has a Re-run jobs menu. It offers Re-run failed jobs and Re-run all jobs. Re-running does not fix anything, but it helps to tell a flaky failure from a repeatable one. The gear menu on the job page lets you view raw logs and download the log archive, which is useful when the browser struggles with a long log.
Exercise
A run shows the jobs build (red), test (grey, skipped), and deploy (grey, skipped). Both test and deploy list needs: build. Which job do you open first, and why?
Show answer
Open build. It is the only job that actually ran and failed. test and deploy were skipped because their needs dependency failed, so they contain no errors to read.
Exercise
On a failed job page, actions/checkout@v4 and actions/setup-node@v4 are green, npm ci is red, and npm test is grey. Which step do you expand, and what does the grey state of npm test tell you?
Show answer
Expand npm ci. The grey npm test step was skipped because an earlier step failed, so it ran no code and its log holds no evidence.