Delete workflow runs #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delete workflow runs | |
on: | |
workflow_dispatch: | |
inputs: | |
status: | |
description: 'Status of runs to delete (completed, failure, success, all)' | |
required: true | |
default: 'failure' | |
type: choice | |
options: | |
- all | |
- failure | |
- success | |
- completed | |
days: | |
description: 'Number of days to keep workflow runs' | |
required: true | |
default: '30' | |
type: number | |
minimum_runs: | |
description: 'Minimum runs to keep per workflow' | |
required: true | |
default: '6' | |
type: number | |
delete_workflow_pattern: | |
description: 'Name or filename of the workflow (leave empty for all)' | |
required: false | |
type: string | |
schedule: | |
- cron: '0 0 * * 0' # Run at 00:00 UTC every Sunday | |
jobs: | |
delete_runs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
retain_days: ${{ github.event.inputs.days || 30 }} | |
keep_minimum_runs: ${{ github.event.inputs.minimum_runs || 6 }} | |
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern || '' }} | |
delete_run_by_conclusion_pattern: ${{ github.event.inputs.status || 'failure' }} |