|
1 | 1 | name: Delete old workflow runs |
2 | 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 |
3 | 43 | schedule: |
4 | 44 | - cron: '5 4 * * 1' |
5 | 45 | # Run weekly, at 04:05 every Monday. |
|
9 | 49 | runs-on: ubuntu-latest |
10 | 50 | steps: |
11 | 51 | - name: Delete workflow runs |
12 | | - uses: GitRML/delete-workflow-runs@main |
| 52 | + uses: Mattraks/delete-workflow-runs@v2 |
13 | 53 | with: |
14 | 54 | token: ${{ github.token }} |
15 | 55 | 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