-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (42 loc) · 1.57 KB
/
cleanup.yml
File metadata and controls
47 lines (42 loc) · 1.57 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# https://github.com/marketplace/actions/delete-workflow-runs
name: Delete old workflow runs
on:
schedule:
- cron: "0 4 * * 1" # Weekly on Monday at 04:00
# to allow manual triggering of the workflow from the GitHub Actions tab:
workflow_dispatch:
jobs:
delete-runs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete all workflow runs but docs,test and build
# those are kept for badges in readme
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
delete_workflow_pattern: dependabot|cleanup|releaseNuget|outdatedNuget
retain_days: 0
keep_minimum_runs: 0
delete_run_by_conclusion_pattern: success
- name: Delete all but last run of all other workflow runs ( docs, test and build)
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 0
# keep only last build, docs, and test run for badge in readme,
# this job runs one per action name.
# this will also keep runs older than 'retain_days'
keep_minimum_runs: 1
delete_run_by_conclusion_pattern: success
- name: Delete all failed runs older than 30 days
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 0