GitHub Actions: re-running jobs with debug logging
A failed run can be re-run whole, only its failed jobs, or one job. Each re-run can also turn on debug logging, just for that attempt, without changing the repository's settings. For every run, set ACTIONS_STEP_DEBUG or ACTIONS_RUNNER_DEBUG instead. From GitHub's documentation on re-running workflows and jobs and debug logging.
Three ways to re-run
On GitHub, open the run. At the top right, Re-run jobs offers Re-run failed jobs and Re-run all jobs; next to a job in the left sidebar, the re-run icon re-runs that job. Tick Enable debug logging in the dialog, then Re-run jobs.
gh run rerun RUN_ID --failed --debug gh run rerun RUN_ID --debug gh run rerun --job JOB_ID --debug
- Failed jobs re-runs the failed jobs and the jobs that depend on them. One job re-runs that job and the jobs that depend on it.
- A re-run is a new attempt of the same run: the same commit (
GITHUB_SHA) and ref (GITHUB_REF), and the privileges of the person who started the run, not of the one who re-runs it. Earlier attempts are in the Latest menu next to the run's name. - Re-running is possible up to 30 days after the first run (after that: "Unable to retry this workflow run because it was created over a month ago"), at most 50 times per run, whole or in part, and not while the workflow is disabled.
What debug logging adds
The box turns on both kinds for the re-run. Anyone who can run the workflow can use it.
- Step debug logging: more detail in each step's log, including the messages a step writes with
echo "::debug::…", which are hidden otherwise. - Runner diagnostic logging: two more files, the runner process log and the worker process log, in the
runner-diagnostic-logsfolder of the run's log archive, which you download; they are not in the page's log view. - While debug logging is on,
runner.debugis1, so a step can be more verbose only then:if: runner.debug == '1'.
Debug logging for every run
Set a repository secret or variable (Settings > Secrets and variables > Actions):
ACTIONS_STEP_DEBUG=truefor step debug logging.ACTIONS_RUNNER_DEBUG=truefor runner diagnostic logging.- When both a secret and a variable of the same name exist, the secret wins.
- Setting them needs write access in an organization's repository, or being a collaborator in a personal one. Organization owners can set them for the whole organization.
With the REST API
curl -X POST -H "Authorization: Bearer <token>" \
https://api.github.com/repos/OWNER/REPO/actions/runs/RUN_ID/rerun-failed-jobs \
-d '{"enable_debug_logging": true}'
- The same body works for
…/runs/RUN_ID/rerun(all jobs) and…/jobs/JOB_ID/rerun(one job). The answer is 201 Created. - The token needs the
reposcope (classic) or, fine-grained, Actions read and write (GitHub's permissions table). Without it, the answer is HTTP 403 "Resource not accessible by personal access token".
Re-run jobs from IntelliJ IDEA
Pipeline Inbox for GitHub Actions Workflows, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the runs of all your repositories in an IDE tool window, with their jobs, steps and logs. Re-run Failed Jobs, Re-run All Jobs and, on a job, Re-run Job send the same requests, with a with debug logging box, so a failing job can be re-run with its debug messages without opening GitHub, and its new log read in the IDE. Reading is free; re-running, cancelling, running workflows and reviewing deployments are Pro (US$1.50 a month, with a 30-day trial).
GitHub and GitHub Actions are trademarks of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with, sponsored or endorsed by GitHub, Inc. or JetBrains.
More: "Unable to retry this workflow run because it was created over a month ago" · "HTTP 410: Server Error" for an old run's logs · Cancelling a run that will not stop · GitHub Actions plugins for IntelliJ IDEA compared · 日本語