Skip to content
Latchkey

gh workflow view: Inspect a Workflow in CI

gh workflow view shows a workflow file, whether it is enabled, and its most recent runs.

Before dispatching or auditing a workflow, gh workflow view confirms the file, its enabled state, and the ID you will reference.

What it does

gh workflow view displays a workflow identified by name, filename, or ID. It shows the enabled or disabled state and recent runs; --yaml prints the workflow YAML at the default branch or a chosen --ref.

Common usage

Terminal
gh workflow view ci.yml
gh workflow view ci.yml --yaml
gh workflow view ci.yml --ref release/1.x
gh workflow view 161335 --json id,name,state

Flags

FlagWhat it does
-y, --yamlPrint the workflow YAML content
-r, --ref <ref>View the workflow at a branch, tag, or SHA
--json <fields>Output workflow data as JSON
-w, --webOpen the workflow in a browser
-R, --repo <owner/repo>Target a specific repository

In CI

Set GH_TOKEN and permissions: { actions: read }. Reference workflows by filename (ci.yml) for stability, since names can change. --yaml --ref lets you confirm what a workflow looked like at the commit a run used.

Common errors in CI

"could not find any workflows named X" means the name or filename is wrong; list them with gh workflow list. "gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable" means GH_TOKEN is missing. A workflow that exists but is disabled still views fine; check the state field.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →