Prune Old Workflow Runs & Artifacts #11
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: Prune Old Workflow Runs & Artifacts | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 0" # Runs every Sunday at midnight UTC | |
| workflow_dispatch: # Allows manual execution | |
| jobs: | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Delete workflow runs | |
| uses: Mattraks/delete-workflow-runs@v2 | |
| with: | |
| token: ${{ github.token }} | |
| repository: ${{ github.repository }} | |
| retain_days: 7 | |
| keep_minimum_runs: 1 | |
| - name: Delete old artifacts | |
| uses: c-hive/gha-remove-artifacts@v1 | |
| with: | |
| age: "7 days" | |
| skip-recent: 1 |