Skip to content

Commit b16fe62

Browse files
authored
Create delete-old-runs.yml (JabRef#12692)
1 parent e50afc0 commit b16fe62

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/delete-old-runs.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Delete old workflow runs
2+
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
43+
44+
jobs:
45+
del_runs:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
actions: write
49+
contents: read
50+
steps:
51+
- name: Delete workflow runs
52+
uses: Mattraks/delete-workflow-runs@v2
53+
with:
54+
token: ${{ github.token }}
55+
repository: ${{ github.repository }}
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)