GitHub Actions: Debugging, Logs, and Troubleshooting

Debug failing GitHub Actions workflows with log grouping, debug logging, step summaries, shell flags, and common troubleshooting patterns.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Debug logging and log structure
Create a collapsible log group
echo "::group::Install dependencies"
npm ci
echo "::endgroup::"

# Group related output in the Actions log.

Emit a notice annotation
echo "::notice title=Build::Build completed successfully"

# Add an informational annotation to the run log.

Emit a warning annotation
echo "::warning file=package.json,line=1::Deprecated config detected"

# Highlight a non-fatal issue in the run log.

Emit an error annotation
echo "::error file=src/app.js,line=42::Build failed"

# Mark a step error with file context.

Write a markdown step summary
echo "## Test Summary" >> "$GITHUB_STEP_SUMMARY"

# Add a rich markdown summary to the workflow run.

## Shell failures and common fixes
Use strict Bash mode
set -euo pipefail

# Fail fast in shell scripts.

Verify workspace contents
find . -maxdepth 3 -type f | sort | head -200

# Check that expected files exist after checkout or artifact download.

Pin actions to a major or full version
- uses: actions/checkout@v4

# Avoid unexpected behavior from drifting dependencies.

Retry a flaky network step in Bash
for i in 1 2 3; do
  npm install && break
  sleep 5
done

# Wrap transient operations in a simple retry loop.

Recommended next

No recommendations yet.