Skip to content

Commit 6a454f6

Browse files
authored
chore: update "Delete old workflow runs" workflow (#28)
The workflow used has been archived and hasn't been updated for a while. This seems to be more active.
1 parent 5401b19 commit 6a454f6

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed
Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
name: Delete old workflow runs
22
on:
3+
workflow_dispatch:
4+
inputs:
5+
days:
6+
description: 'Days-worth of runs to keep for each workflow'
7+
required: true
8+
default: '30'
9+
minimum_runs:
10+
description: 'Minimum runs to keep for each workflow'
11+
required: true
12+
default: '6'
13+
delete_workflow_pattern:
14+
description: 'Name or filename of the workflow (if not set, all workflows are targeted)'
15+
required: false
16+
delete_workflow_by_state_pattern:
17+
description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
18+
required: true
19+
default: "ALL"
20+
type: choice
21+
options:
22+
- "ALL"
23+
- active
24+
- deleted
25+
- disabled_inactivity
26+
- disabled_manually
27+
delete_run_by_conclusion_pattern:
28+
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
29+
required: true
30+
default: "ALL"
31+
type: choice
32+
options:
33+
- "ALL"
34+
- "Unsuccessful: action_required,cancelled,failure,skipped"
35+
- action_required
36+
- cancelled
37+
- failure
38+
- skipped
39+
- success
40+
dry_run:
41+
description: 'Logs simulated changes, no deletions are performed'
42+
required: false
343
schedule:
444
- cron: '5 4 * * 1'
545
# Run weekly, at 04:05 every Monday.
@@ -9,8 +49,18 @@ jobs:
949
runs-on: ubuntu-latest
1050
steps:
1151
- name: Delete workflow runs
12-
uses: GitRML/delete-workflow-runs@main
52+
uses: Mattraks/delete-workflow-runs@v2
1353
with:
1454
token: ${{ github.token }}
1555
repository: ${{ github.repository }}
16-
retain_days: 30
56+
retain_days: ${{ github.event.inputs.days }}
57+
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
58+
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
59+
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
60+
delete_run_by_conclusion_pattern: >-
61+
${{
62+
startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:')
63+
&& 'action_required,cancelled,failure,skipped'
64+
|| github.event.inputs.delete_run_by_conclusion_pattern
65+
}}
66+
dry_run: ${{ github.event.inputs.dry_run }}

0 commit comments

Comments
 (0)