Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Cleanup old workflow runs #364

Merged
merged 1 commit into from
Aug 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Cleanup"
on:
workflow_dispatch:
inputs:
days:
description: 'Retain days'
required: true
default: 30
minimum_runs:
description: 'Minimum runs to keep for each workflow'
required: true
default: 6
delete_workflow_pattern:
description: 'Name/filename of workflow. Default is all.'
required: false
delete_workflow_by_state_pattern:
description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
required: true
default: "All"
type: choice
options:
- "All"
- active
- deleted
- disabled_inactivity
- disabled_manually
dry_run:
description: 'Dry run?'
required: false

jobs:

del-runs:
name: "Delete old workflow runs"
runs-on: ubuntu-latest

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