Skip to content

Delete old workflow runs #85

Delete old workflow runs

Delete old workflow runs #85

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 }}