mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Disable A Workflow With The gh CLI as a GitHub Actions TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1317 TILs and counting..._
|
_1318 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -346,6 +346,7 @@ _1317 TILs and counting..._
|
|||||||
|
|
||||||
- [Cache Playwright Dependencies Across Workflows](github-actions/cache-playwright-dependencies-across-workflows.md)
|
- [Cache Playwright Dependencies Across Workflows](github-actions/cache-playwright-dependencies-across-workflows.md)
|
||||||
- [Capture An Output Value For Use In A Later Step](github-actions/capture-an-output-value-for-use-in-a-later-step.md)
|
- [Capture An Output Value For Use In A Later Step](github-actions/capture-an-output-value-for-use-in-a-later-step.md)
|
||||||
|
- [Disable A Workflow With The gh CLI](github-actions/disable-a-workflow-with-the-gh-cli.md)
|
||||||
- [Reference An Encrypted Secret In An Action](github-actions/reference-an-encrypted-secret-in-an-action.md)
|
- [Reference An Encrypted Secret In An Action](github-actions/reference-an-encrypted-secret-in-an-action.md)
|
||||||
- [Trigger A Workflow Via An API Call](github-actions/trigger-a-workflow-via-an-api-call.md)
|
- [Trigger A Workflow Via An API Call](github-actions/trigger-a-workflow-via-an-api-call.md)
|
||||||
|
|
||||||
|
|||||||
41
github-actions/disable-a-workflow-with-the-gh-cli.md
Normal file
41
github-actions/disable-a-workflow-with-the-gh-cli.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Disable A Workflow With The gh CLI
|
||||||
|
|
||||||
|
You may want to temporarily disable a GitHub Actions workflow without deleting
|
||||||
|
the file for the workflow. In my case, this is handy because I want to keep a
|
||||||
|
scheduled workflow around as a point of reference, but I don't want it running
|
||||||
|
all the time.
|
||||||
|
|
||||||
|
This can be done with [the `workflow` subcommand of the `gh`
|
||||||
|
CLI](https://docs.github.com/en/actions/using-workflows/disabling-and-enabling-a-workflow?tool=cli).
|
||||||
|
|
||||||
|
First, list the workflows for your current repo so that you can figure out the
|
||||||
|
workflow ID that you want to disable.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gh workflow list
|
||||||
|
GitHub Actions Demo active 60018591
|
||||||
|
Playwright Demo active 60142509
|
||||||
|
Scheduled Actions Demo active 60028624
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, copy the ID of the workflow you want to disable. In my case, it is
|
||||||
|
`60028624`.
|
||||||
|
|
||||||
|
Then, run the `disable` command for that workflow ID:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gh workflow disable 60028624
|
||||||
|
✓ Disabled Scheduled Actions Demo
|
||||||
|
```
|
||||||
|
|
||||||
|
That workflow is now disabled and it is no longer going to show up in the
|
||||||
|
default listing of workflows.
|
||||||
|
|
||||||
|
If you want to see it in the list though, you can include the `--all` flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gh workflow list --all
|
||||||
|
GitHub Actions Demo active 60018591
|
||||||
|
Playwright Demo active 60142509
|
||||||
|
Scheduled Actions Demo disabled_manually 60028624
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user