How to debug GitHub Actions: debug logs, SSH, run locally
Debug a failing workflow: ACTIONS_STEP_DEBUG and runner debug logs, why a job was skipped, gh run view, actionlint, act locally, and SSH into the runner.
In this series26 guides, you're on Debugging
A workflow runs on a machine you can’t see, so debugging it is mostly about getting more information out of that machine. From the cheapest to the most hands-on:
- Read the failed step’s log properly (and download the full logs).
- Re-run with debug logging.
- Print the contexts and the environment.
- Lint the workflow before pushing.
- Run it locally with
act. - Open a shell on the runner.
Read the logs from the terminal#
The GitHub CLI ↗ is faster than clicking through the UI:
gh run list --workflow ci.yml --limit 5 # recent runsgh run view <run-id> --log-failed # only the logs of the failed stepsgh run watch <run-id> # follow a run livegh run rerun <run-id> --failed --debug # re-run failed jobs with debug loggingIn the web UI, the gear icon on a job’s log gives Download log archive, with one file per step, including the setup and post steps the page collapses.
With GitHub Copilot (the free plan included), Explain error at the top of a failed run’s summary page, or next to the failed check in a pull request, reads the failed job’s log and suggests a fix. It’s a quick first pass before you dig into the logs.
Enable debug logging#
There are two debug logs, and both are off by default:
| Variable | Adds |
|---|---|
ACTIONS_STEP_DEBUG | ::debug:: messages from actions and steps, plus the evaluation of expressions and conditions, in each step’s log |
ACTIONS_RUNNER_DEBUG | The runner’s own diagnostic logs (job setup, the runner process, the worker), added to the log archive as runner-diagnostic-logs |
Two ways to turn them on:
- For one run: on a finished run, Re-run jobs → Enable debug logging (or
gh run rerun --debug). This sets both for the re-run only. A re-run uses the original commit, so it picks up the debug settings but not workflow changes you pushed since. A run can be re-run for 30 days, and at most 50 times (full re-runs and re-runs of some jobs both count). - For every run: create a repository secret or variable named
ACTIONS_STEP_DEBUG(and/orACTIONS_RUNNER_DEBUG) with the valuetrue. If both a secret and a variable exist, the secret wins. Remove it when you’re done: debug logs are long.
With step debug on, the log shows why a step was skipped, for example Evaluating: (success() && (github.ref == 'refs/heads/main')), then Expanded: (true && ('refs/heads/dev' == 'refs/heads/main')) and Result: false. That alone solves most “why didn’t my step run?” questions.
Job conditions don’t need debug logging. Since January 2026, GitHub logs how it evaluated each job-level if:. Open the job, choose Download log archive from the gear menu, and read JOB-NAME/system.txt. It has the same three lines: Evaluating: is your condition as GitHub evaluated it (implicit success() included), Expanded: is the same expression with the runtime values filled in, and Result: is the outcome.
Debug output from your own steps#
steps: - run: | echo "::debug::only visible when step debug logging is on" echo "::notice file=app.js,line=10::shown as an annotation on the run" echo "::warning::deprecated input used" echo "::group::Installed packages" npm ls --depth=0 echo "::endgroup::"
# runner.debug is '1' when step debug logging is on # (ACTIONS_STEP_DEBUG, or a re-run with debug logging) - if: runner.debug == '1' run: env | sort::group:: folds a noisy section in the log, and ::error::, ::warning:: and ::notice:: create annotations shown on the run summary (and on the pull request’s files when file and line are given). In JavaScript actions, core.debug(), core.warning() and core.startGroup() do the same.
Print the contexts#
Many failures come from an expression that doesn’t hold the value you expect. Dump the contexts once, in a step that runs whatever happens. if: always() runs it even after a failure or a cancel, which costs nothing for a step this quick:
- name: Dump contexts if: always() continue-on-error: true env: GITHUB_CONTEXT: ${{ toJSON(github) }} JOB_CONTEXT: ${{ toJSON(job) }} STEPS_CONTEXT: ${{ toJSON(steps) }} NEEDS_CONTEXT: ${{ toJSON(needs) }} MATRIX_CONTEXT: ${{ toJSON(matrix) }} run: | echo "$GITHUB_CONTEXT" echo "$JOB_CONTEXT" echo "$STEPS_CONTEXT" echo "$NEEDS_CONTEXT" echo "$MATRIX_CONTEXT"Pass contexts through env rather than writing ${{ toJSON(github) }} inside run: the event payload contains user-controlled text (PR titles, commit messages), and interpolating it into a script is how shell injection happens. Secrets are masked in the output, but don’t print the secrets context anyway.
toJSON(github) includes the whole event payload, and on Linux a single environment variable can’t exceed 128 KiB. A push of many commits or a pull request with a long description can go past that: the step then fails with “Argument list too long”, and continue-on-error: true keeps that from failing the job. The payload is also on disk, so jq . "$GITHUB_EVENT_PATH" prints it without an environment variable.
For results you want to read without opening the log, write Markdown to $GITHUB_STEP_SUMMARY. It shows on the run’s summary page and is deleted with the run when the retention period ends (90 days by default):
- run: | echo "### Test results" >> "$GITHUB_STEP_SUMMARY" echo "- passed: $PASSED" >> "$GITHUB_STEP_SUMMARY"Since October 1, 2026, the same retention setting also deletes the run itself, with its checks and commit statuses, which GitHub used to keep for 400 days or more.
Lint the workflow before pushing#
actionlint ↗ catches most errors that otherwise cost a push and a run: YAML mistakes, unknown keys, wrong context names, expressions of the wrong type, missing needs, shell errors in run (with shellcheck installed) and risky interpolation of untrusted input.
brew install actionlint # or: go install github.com/rhysd/actionlint/cmd/actionlint@latestactionlint # checks every file in .github/workflows/Run it in a pre-commit hook or as a first CI step. When GitHub can’t parse a workflow file, none of its jobs run: the run shows up as failed with the error at the top, and for some triggers no run shows up at all.
As of November 2026, the latest actionlint release, 1.7.12 (March 2026), predates parallel steps, concurrency.queue and cache-mode. It reports them as errors and doesn’t check the steps inside a parallel group. If your workflows use them, filter those messages:
actionlint -ignore 'unexpected key "(background|queue|cache-mode)"' -ignore 'step must run script'The second filter also hides a real step with neither run nor uses. The GitHub Actions extension for VS Code accepts parallel steps and queue, but not yet cache-mode.
Run the workflow locally with act#
act ↗ runs workflows in Docker on your machine, so you can iterate without pushing:
act -l # list the jobsact push -j test # run the test job as if on pushact pull_request -e event.json # with a custom event payloadact -s GITHUB_TOKEN="$(gh auth token)" # pass a secretWhere it falls short:
- The environment differs. act’s default images are much smaller than GitHub’s runner images; use the larger
catthehacker/ubuntu:full-*images when tools are missing, and expect differences anyway. - Linux containers only. macOS and Windows jobs run only on a host with that OS, directly and without isolation (
-P macos-latest=-self-hosted). Services, caches and artifacts are partly emulated. - GitHub-only features don’t exist. OIDC tokens, environments and their approvals, and anything that calls the GitHub API with the job’s token behave differently or fail.
- Newer syntax breaks it. act 0.2.97, the latest release as of November 2026, validates every workflow file against a schema that has no parallel steps (
background,wait,wait-all,cancel,parallel),concurrency.queue,cache-modeorcase(), and stops with “workflow is not valid”. One such file breaksact -landact pushfor the whole folder, so point act at another file with-W .github/workflows/ci.yml. - Some features are ignored. act discards job summaries and annotations, and ignores
concurrencyand job-leveltimeout-minutesandcontinue-on-error.
Use act to iterate on scripts and step logic, and the real runner for the final check.
Open a shell on the runner#
When the logs aren’t enough, connect to the machine while the job runs. action-tmate ↗ no longer works out of the box: tmate’s public relay (ssh.tmate.io) shut down in July 2025, so it needs your own tmate-ssh-server (its tmate-server-* inputs). action-upterm ↗ opens the same kind of session through upterm’s public relay and prints an SSH command in the log:
- name: Debug session on failure if: failure() uses: owenthereal/action-upterm@v2 with: limit-access-to-actor: true # only the GitHub SSH keys of whoever started or re-ran the job wait-timeout-minutes: 10 # end the session if nobody joins timeout-minutes: 30The step holds the job until you type exit, which ends the session, or run touch $GITHUB_WORKSPACE/continue, which keeps the session open until the job ends. Run it only on failure, restrict access to the actor, and set a timeout. Without limit-access-to-actor, anyone who can read the log can join the session. Without timeout-minutes, a forgotten session holds a runner (and bills it) until the job’s 6-hour limit; wait-timeout-minutes also ends it early when nobody joins. Don’t use it in workflows that run on fork pull requests.
On RunsOn, you can connect to the runner without a third-party relay; see On RunsOn.
Common causes, quickly#
- The workflow didn’t run at all: a filter or
[skip ci]skipped it, its file isn’t on the default branch, the event came fromGITHUB_TOKEN, or the workflow is disabled. The triggers guide lists every cause. Runs for fork pull requests can also wait for a maintainer’s approval. - The run fails at once with “Event ’…’ is not allowed to trigger Actions workflows”: an Actions policy blocks that event. In public repositories, a default policy blocks
pull_request_targetfrom December 2, 2026 (and in brownout windows from November 9) unless an event policy allows it; see pull_request vs pull_request_target. - A job was skipped: its
system.txtin the log archive shows why (see above and why was my job skipped?). Jobs that need a failed or skipped job are skipped too, unless theirif:says otherwise; see conditions. - A step was skipped: an
ifwithout a status function only runs after success; see conditions. - Works locally, fails in CI: a missing environment variable, a different tool version (pin it with a
setup-*action), or the 14 GB disk of standard runners (see no space left on device). - A “Node.js 20 actions are deprecated” warning on the run: an action in the job declares
using: node20in itsaction.yml, and the warning names it. Update each named action to a major version that runs on Node 24, for exampleactions/checkout@v5or later. The variant “are being forced to run on Node.js 24” means the runner already runs that action on Node 24 although it targets Node 20; updating is still the fix. Once Node 24 is the default,ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: trueinenv:keeps Node 20 for a while, until GitHub requires Node 24. - “Resource not accessible by integration”: the
GITHUB_TOKENlacks a permission. Add it underpermissions:; listing one permission sets every unlisted one tonone. Onpull_requestruns from forks, the token stays read-only whatever you list; see pull_request vs pull_request_target. To act on another repository, use a GitHub App token. - A job sits in “Waiting for a runner to pick up this job” (and is cancelled after 24 hours): no runner matches its
runs-onlabels; see runs-on. To see how long jobs usually wait, open the repository’s or organization’s Insights → Actions Performance Metrics: the Jobs tab shows each job’s average queue time.
On RunsOn#
RunsOn runs each job on an EC2 instance in your AWS account, so you can open a shell on the runner without a third-party relay: through AWS Systems Manager (roc connect <job-url> with the RunsOn CLI) or with SSH. On Flex, SSH needs SSHAllowed turned on in the stack and the ssh=true label on the job; the job log’s Set up job section then shows how to connect. The Flex label debug=true (Linux) pauses the job before its first step until you run sudo rm /runs-on/hooks/debug.lock:
jobs: test: runs-on: runs-on=${{ github.run_id }}/runner=2cpu-linux-x64/ssh=true/debug=trueThe instance is terminated when the job ends, so to inspect a failure, keep the job alive with a last step that has if: failure() and runs sleep 1800, and connect while it waits.
On Fleet, the platform team sets up SSH in Terraform, not per job; see remote access.