-
-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (32 loc) · 1011 Bytes
/
delete-old-runs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Delete old workflow runs
on:
workflow_dispatch:
inputs:
days:
description: 'Number of days.'
required: true
default: '30'
minimum_runs:
description: 'The minimum runs to keep for each workflow.'
required: true
default: '6'
schedule:
- cron: '0 4 * * *'
jobs:
delete_old_workflows:
runs-on: ubuntu-latest
steps:
- name: Set the variables
env:
DEFAULT_DAYS: 14
DEFAULT_MINIMUM_RUNS: 3
run: |
echo "DAYS=${{ github.event.inputs.days || env.DEFAULT_DAYS }}" >> "${GITHUB_ENV}"
echo "MINIMUM_RUNS=${{ github.event.inputs.minimum_runs || env.DEFAULT_MINIMUM_RUNS }}" >> "${GITHUB_ENV}"
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: ${{ env.DAYS }}
keep_minimum_runs: ${{ env.MINIMUM_RUNS }}