Skip to content

workflow-run-cleaner #42

workflow-run-cleaner

workflow-run-cleaner #42

name: workflow-run-cleaner
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
inputs:
retain_days:
description: "The number of days that is used to compare with the retention days of each workflow."
required: true
default: "30"
keep_minimum_runs:
description: "The minimum runs to keep for each workflow."
required: true
default: "7"
delete_workflow_pattern:
description: "The name or filename of the workflow. If not set then it will target all workflows."
required: false
delete_workflow_by_state_pattern:
description: "Remove workflow runs by state."
required: false
default: all
type: choice
options:
- all
- active
- deleted
- disabled_fork
- disabled_inactivity
- disabled_manually
dry_run:
description: "Only log actions, do not perform any delete operations."
required: false
jobs:
delete:
runs-on: ubuntu-latest
steps:
- uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: ${{ github.event.inputs.retain_days }}
keep_minimum_runs: ${{ github.event.inputs.keep_minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
dry_run: ${{ github.event.inputs.dry_run }}