Delete old workflow runs #85
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 old workflow runs | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| # Weekly (every Sunday at midnight UTC) | |
| workflow_dispatch: | |
| inputs: | |
| days: | |
| description: 'Number of days of runs to retain.' | |
| required: true | |
| default: 30 | |
| minimum_runs: | |
| description: 'Minimum number of runs to keep for each workflow.' | |
| required: true | |
| default: 6 | |
| jobs: | |
| del_runs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write # Necessary to delete workflow runs | |
| contents: read # Necessary to read repository contents | |
| steps: | |
| - name: Delete workflow runs | |
| uses: Mattraks/delete-workflow-runs@v2 | |
| with: | |
| token: ${{ github.token }} | |
| repository: ${{ github.repository }} | |
| retain_days: ${{ github.event.inputs.days }} | |
| keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} |