C.W.K.
Stream
Lesson 08 of 13 · published

Debugging Workflows

~10 min · debug, logs, runner-debug

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

The debug toolkit

  1. Re-run with debug logging — UI button on a failed run; or set ACTIONS_RUNNER_DEBUG=true + ACTIONS_STEP_DEBUG=true as repo secrets. Logs become 5–10× longer, but you see every API call.
  2. Step debug actionmxschmitt/action-tmate opens an SSH session to the runner mid-job. Useful (and dangerous — anyone watching the session steals secrets).
  3. Step Summary — append diagnostic info to $GITHUB_STEP_SUMMARY from inside the failing step.
  4. Artifact dumpsif: always() upload the failure-relevant files (logs, screenshots, env dumps) so you can download and inspect.
  5. Reproduce locally — same image, same env, with act or just Docker.

Common bugs and what surfaces them

  • Step is skipped unexpectedly → check the if: expression; act prints the resolved value.
  • Secret seems empty → it's not in scope (org / env mismatch) or it's a fork PR.
  • Cache never restores → key mismatch; run with debug to see the resolved key string.
  • Matrix produces no jobs → empty fromJSON input; check upstream job's output.
  • Self-hosted runner not picking up → label mismatch, runner offline, or runner busy.

Code

Always-upload diagnostic bundle on failure·yaml
      - name: Run e2e
        run: ./tests/e2e.sh
      - name: Diagnostic bundle
        if: always()
        run: |
          mkdir -p diag
          cp -r logs/ diag/
          docker compose logs > diag/compose.log 2>&1 || true
          env | sort | grep -v -i 'TOKEN\|KEY\|SECRET' > diag/env.log
      - if: always()
        uses: actions/upload-artifact@v4
        with:
          name: diag-${{ github.run_id }}-${{ github.run_attempt }}
          path: diag/
          retention-days: 7

External links

Exercise

Pick a workflow that has failed within the last month. Re-run it with debug logging and read the resolved expressions / API calls. Spot at least one piece of info you didn't have before.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.