11name : Delete old workflow runs
22on :
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
3+ schedule :
4+ - cron : ' 0 0 1 * *'
5+ # Run monthly, at 00:00 on the 1st day of month.
436
447jobs :
458 del_runs :
5316 with :
5417 token : ${{ github.token }}
5518 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 }}
19+ retain_days : 30
20+ keep_minimum_runs : 6
0 commit comments