Sub topic 12
Owning and Triaging Nightly Failures
This chapter assumes you know how scheduled workflows run in GitHub Actions or a similar CI system. It also assumes you have read the earlier chapters on what to defer to nightly builds and on flaky tests. Nightly checks only help if someone reads the results. A red nightly run that nobody owns turns into background noise within a few weeks.
Why nightly failures need an owner
A pull request failure has an obvious owner: the author. A nightly failure has no author. The run was triggered by a clock, not by a person, so nobody feels responsible for it.
Without a named owner, three things tend to happen:
- Each engineer assumes someone else is looking at it.
- The same failure repeats for days, and people stop noticing it.
- A real regression hides behind failures everyone has learned to ignore.
The fix is to decide who owns the result before the first failure, not after.
Assign ownership
Pick one of these models and write it down in the repository, for example in a CONTRIBUTING.md or an on-call document.
| Model | How it works | Best for |
|---|---|---|
| Rotating triager | One person per week reads every nightly result | Small and mid-size teams with one shared suite |
| Test owner by area | Each test suite or directory maps to a team | Larger codebases with clear boundaries |
| Author of the suspect change | The person whose commit most likely broke it is paged | Failures that are easy to bisect |
A rotating triager is the simplest starting point. The triager is not required to fix every failure. Their job is to make sure each failure gets a decision and an owner.
Make failures visible
Do not rely on people opening the Actions tab. Send the result to where the team already looks. A failed scheduled run can open an issue or post to a chat channel.
The workflow below extends the nightly job from the earlier chapter. It opens an issue only when the run fails, and it links to the run so the triager can start immediately.
name: nightly
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run test:e2e
- name: Open an issue on failure
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue create \
--title "Nightly e2e failed on $(date -u +%F)" \
--label nightly-failure \
--body "Run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"The if: failure() condition runs the step only when an earlier step failed. The issues: write permission is granted to this job only, which follows least privilege.
Triage in a fixed order
When a nightly run fails, work through the same questions each time. A fixed order keeps the triager from guessing.
- Check for infrastructure causes. Look for runner outages, expired credentials, or an unavailable test environment. These are not code defects.
- Rerun once. Use
workflow_dispatchto trigger a fresh run. If it passes, treat the test as flaky and follow your quarantine process. - Find the change. If it fails again, compare the last green run with the failing one. Bisect the commits in between.
- Resolve it. Either fix forward or revert the offending commit, and tell its author.
Track time to resolution
Record how long each failure stays open. A common team rule is that a nightly failure must have an owner within one working day and a fix, revert, or quarantine within three. If failures regularly miss that rule, the nightly suite is too large, too flaky, or understaffed.
Exercise
A nightly end-to-end run fails on Tuesday. The triager reruns it and it passes. What should the triager do next, and why?
Show answer
Treat the test as flaky. Quarantine it so it stops producing red runs, and file a ticket with an owner and a due date to fix it. Rerunning alone hides the problem, so the failure would return and wear down trust in the nightly results.