File tree 4 files changed +44
-34
lines changed
4 files changed +44
-34
lines changed Original file line number Diff line number Diff line change 4
4
5
5
Clean up your outdated GitHub Actions workflow logs.
6
6
7
- ![ OG Image] ( ./img/og .png )
7
+ ![ Cover Image] ( ./img/cover .png )
8
8
9
9
## Usage
10
10
11
11
``` console
12
12
$ gh workflow-log-cleaner " Your Workflow Name (<workflow-id> or <workflow-name> or <filename>)"
13
13
```
14
14
15
+ ## Example
16
+
17
+ ``` console
18
+ $ gh workflow-log-cleaner test
19
+ ```
20
+
21
+ ``` console
22
+ $ gh workflow-log-cleaner test --limit 10
23
+ ```
24
+
15
25
## Don't know your workflow name?
16
26
17
27
If you don't know your workflow name or workflow id, you can find it by running ` gh workflow-log-cleaner ` without any arguments.
18
28
19
29
``` console
20
30
$ gh workflow-log-cleaner
21
- Usage:
22
- gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>]
31
+ USAGE
32
+ gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]
33
+
34
+ OPTIONS
35
+ -h, --help Show this help message and exit
36
+ --limit int Limit the number of runs to delete (default: 1000)
37
+
38
+ EXAMPLES
39
+ Remove logs for the test workflow
40
+ $ gh workflow-log-cleaner test
23
41
24
- Available workflows:
42
+ AVAILABLE WORKFLOWS
25
43
NAME STATE ID
26
44
setup active 114854128
27
45
test active 114855097
Original file line number Diff line number Diff line change @@ -7,15 +7,23 @@ export GH_PAGER=
7
7
LIMIT=" 1000"
8
8
WORKFLOW=" "
9
9
10
+ bold_echo () {
11
+ echo -e " \e[1m$1 \e[0m"
12
+ }
13
+
10
14
help () {
11
- echo " Usage: "
15
+ bold_echo " USAGE "
12
16
echo " gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]"
13
17
echo " "
14
- echo " Options: "
15
- echo " -h, --help Show this help message and exit"
16
- echo " --limit Limit the number of runs to delete (default: 1000)"
18
+ bold_echo " OPTIONS "
19
+ echo " -h, --help Show this help message and exit"
20
+ echo " --limit int Limit the number of runs to delete (default: 1000)"
17
21
echo " "
18
- echo " Available workflows:"
22
+ bold_echo " EXAMPLES"
23
+ echo " Remove logs for the test workflow"
24
+ echo " $ gh workflow-log-cleaner test"
25
+ echo " "
26
+ bold_echo " AVAILABLE WORKFLOWS"
19
27
gh workflow list --all
20
28
}
21
29
@@ -47,9 +55,9 @@ while [ $# -gt 0 ]; do
47
55
done
48
56
49
57
if [ -z " $WORKFLOW " ]; then
50
- echo " Error: Specify a workflow to delete the log."
51
- help
52
- exit 1
58
+ echo " Error: Specify a workflow to delete the log."
59
+ help
60
+ exit 1
53
61
fi
54
62
55
63
for id in $( gh run list --workflow " $WORKFLOW " --json databaseId --jq ' .[].databaseId' --limit $LIMIT ) ; do
Original file line number Diff line number Diff line change @@ -10,33 +10,17 @@ assert_output_contains() {
10
10
@test " without parameter" {
11
11
run ./gh-workflow-log-cleaner
12
12
[ " $status " -eq 0 ]
13
- expected_output=" Usage:
14
- gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]
15
-
16
- Options:
17
- -h, --help Show this help message and exit
18
- --limit Limit the number of runs to delete (default: 1000)
19
-
20
- Available workflows:
21
- setup active 114854128
22
- test active 114855097"
23
- [ " $output " = " $expected_output " ]
13
+ assert_output_contains ' gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]'
14
+ assert_output_contains ' setup active 114854128
15
+ test active 114855097'
24
16
}
25
17
26
18
@test " with help option" {
27
19
run ./gh-workflow-log-cleaner --help
28
20
[ " $status " -eq 0 ]
29
- expected_output=" Usage:
30
- gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]
31
-
32
- Options:
33
- -h, --help Show this help message and exit
34
- --limit Limit the number of runs to delete (default: 1000)
35
-
36
- Available workflows:
37
- setup active 114854128
38
- test active 114855097"
39
- [ " $output " = " $expected_output " ]
21
+ assert_output_contains ' gh workflow-log-cleaner [<workflow-id> | <workflow-name> | <filename>] [options]'
22
+ assert_output_contains ' setup active 114854128
23
+ test active 114855097'
40
24
}
41
25
42
26
@test " with a workflow-name and limit option" {
File renamed without changes.
You can’t perform that action at this time.
0 commit comments