9 / 48 · 16 CI/CD Pipelines · GitHub Actions: A Practical Example← prev⊞ allnext →☰ Read as one page
2.4Debugging GitHub Actions
Debugging workflows is one of the biggest pain points. Here are practical strategies:
- Enable debug logging: Set the repository secret
ACTIONS_STEP_DEBUGtotruefor verbose output - Use
actlocally: The act tool runs GitHub Actions workflows on your local machine, dramatically speeding up iteration - Add diagnostic steps: Insert
envandls -lasteps to inspect the environment when something unexpected happens - Check the Actions tab: Failed steps show expandable logs. Look at the last successful step and the first failed step to narrow the issue
- Use
continue-on-error: truetemporarily: Let a failing step continue so you can see the output of subsequent steps for debugging
# Temporary debugging step
- name: Debug environment
if: failure()
run: |
echo "Working directory: $(pwd)"
ls -la
env | sort
cat package.json | head -20