Skip to content
Latchkey

gh workflow enable and disable in CI

gh workflow enable and gh workflow disable turn a workflow on or off so it stops or resumes triggering.

During incidents or migrations you sometimes need to pause a noisy workflow; these two commands flip its state without editing the file.

What it does

gh workflow disable stops a workflow from being triggered by any event while leaving the file in place; gh workflow enable re-activates it. Both accept a workflow name, filename, or ID, or prompt interactively.

Common usage

Terminal
gh workflow disable nightly.yml
gh workflow enable nightly.yml
gh workflow disable 161335 -R owner/repo

Flags

ArgumentWhat it does
<workflow>Workflow name, filename, or numeric ID
-R, --repo <owner/repo>Target a specific repository

In CI

Set GH_TOKEN and permissions: { actions: write }. Pass the workflow by filename so the command is deterministic on a headless runner; without an argument it tries to prompt. A disabled workflow ignores all events, including schedule and workflow_dispatch.

Common errors in CI

"Resource not accessible by integration" or "HTTP 403" means the token lacks actions: write. "could not find any workflows named X" means the identifier is wrong; check gh workflow list. Disabling an already-disabled workflow is a no-op rather than an error.

Related guides

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