Skip to content

Commit 55a5ac6

Browse files
committed
✨ Delete workflow and all its runs docs
1 parent 41095af commit 55a5ac6

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
import Tabs from "@theme/Tabs";
6+
import TabItem from "@theme/TabItem";
7+
8+
# Delete workflow and all its runs
9+
10+
## Why delete an entire workflow?
11+
12+
- You have created experimental workflows in the `.github/workflows` folder of your repository and you want to delete them permanently.
13+
- You have accidentally leaked confidential information or credentials in the logs of a workflow and you want to erase them.
14+
- You want to rename your workflow and don't want to keep the old name in the list of available workflows.
15+
16+
:::warning
17+
Note that this operation is irreversible and you will lose all logs and artifacts associated with the deleted workflow. If you want to keep a record of your old workflows, you can archive them in a separate branch or repository before deleting them.
18+
:::
19+
20+
We hope this documentation has been helpful for managing your GitHub workflows.
21+
22+
## How to delete a workflow
23+
24+
### Install the [GitHub CLI](https://github.com/cli/cli#installation)
25+
26+
<Tabs groupId="operating-systems">
27+
<TabItem value="linux" label="Linux">
28+
29+
```bash
30+
sudo apt install gh
31+
```
32+
33+
</TabItem>
34+
<TabItem value="macOS" label="macOS">
35+
36+
```bash
37+
brew install gh
38+
```
39+
40+
</TabItem>
41+
</Tabs>
42+
43+
### Log in to your GitHub account
44+
45+
```bash
46+
gh auth login
47+
```
48+
49+
Then, follow the instructions.
50+
51+
### Command to delete all workflows
52+
53+
:::caution
54+
`GH_USERNAME_OR_ORG` is your GitHub username or organization name.
55+
:::
56+
57+
```bash title="bash"
58+
user="GH_USERNAME_OR_ORG" repo="REPO_NAME"; gh api repos/$user/$repo/actions/runs \
59+
--paginate -q '.workflow_runs[] | select(.head_branch != "master") | "\(.id)"' | \
60+
xargs -n1 -I % gh api --silent repos/$user/$repo/actions/runs/% -X DELETE
61+
```
62+
63+
:::info
64+
May need to re-run the command because of the rate limit of the GitHub API.
65+
:::

docs/github/actions/job-outputs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 3
2+
sidebar_position: 1
33
---
44

55
# Job outputs

docs/github/actions/selfhosted-runners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 1
2+
sidebar_position: 5
33
---
44

55
# GitHub self hosted runner

0 commit comments

Comments
 (0)