gh run view: Usage, Options & Common CI Errors
Inspect a workflow run - its jobs, steps, and logs.
gh run view shows the details of a workflow run: each job and step, their conclusions, and (on request) the logs - including just the failed steps for fast debugging.
What it does
gh run view <run-id> prints a run’s jobs and step outcomes. --log streams the full logs, --log-failed shows only the logs of failed steps, and --job targets a single job. With no ID it can prompt or resolve interactively, so pass the ID in CI.
Common usage
# View a run's jobs and steps
gh run view 1234567890
# Show only the logs of failed steps (great for triage)
gh run view 1234567890 --log-failed
# View a specific job's full log
gh run view --job 9876543210 --logCommon error in CI: logs not available / run still in progress
gh run view --log fails with "log not found" or returns empty logs when the run is still in progress or its logs have expired (GitHub retains them for a limited time). Fix: wait for completion (gh run watch first), then view logs; for finished-but-old runs, accept that expired logs are gone. Always pass an explicit run ID in CI - get it from gh run list --json databaseId. Token needs actions: read.
Key options
| Option | Purpose |
|---|---|
| [run-id] | Which run to view |
| --log | Print full logs |
| --log-failed | Print logs of failed steps only |
| -j, --job | View a specific job |
| --exit-status | Exit nonzero if the run failed |