Cleanup Workflows #11
This file contains 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: Cleanup Workflows | |
on: | |
# cronjob trigger At 00:00 on day-of-month 1. https://crontab.guru/every-month | |
schedule: | |
- cron: "0 0 1 * *" | |
workflow_dispatch: | |
inputs: | |
delete_workflow_pattern: | |
description: 'Pattern to match workflow names' | |
required: false | |
delete_workflow_by_state_pattern: | |
description: 'Pattern to match workflow state' | |
required: false | |
delete_run_by_conclusion_pattern: | |
description: 'Pattern to match run conclusion' | |
required: false | |
dry_run: | |
description: 'Dry run mode' | |
required: false | |
concurrency: | |
group: workflow-cleanup-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
clean-workflows: | |
runs-on: ubuntu-latest | |
name: Clean-up Workflow History | |
permissions: | |
actions: write | |
steps: | |
- name: Delete Stale Workflows | |
uses: Mattraks/delete-workflow-runs@39f0bbed25d76b34de5594dceab824811479e5de # v2.0.6 | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 15 | |
keep_minimum_runs: 0 | |
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }} | |
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }} | |
delete_run_by_conclusion_pattern: ${{ github.event.inputs.delete_run_by_conclusion_pattern }} | |
dry_run: ${{ github.event.inputs.dry_run }} |