-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (65 loc) · 2.12 KB
/
maintenance.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Maintenance
on:
schedule:
- cron: "0 0 1 * *" # Monthly cleanup
workflow_dispatch:
inputs:
run_package_cleanup:
description: "Run package cleanup"
type: boolean
default: true
run_actions_cleanup:
description: "Run actions cleanup"
type: boolean
default: true
packages:
description: "Packages to clean (comma-separated, overrides DEFAULT_PACKAGES)"
type: string
required: false
keep_versions:
description: "Number of package versions to keep"
type: string
default: '3'
required: false
artifact_type:
description: "Type of artifact to clean"
type: choice
options:
- container
- helm
default: "container"
required: false
retention_days:
description: "Days to retain action runs"
type: string
default: '90'
required: false
workflow_states:
description: 'Workflow states (e.g. deleted, disabled_fork, etc.) to clean (comma-separated or "ALL")'
type: string
default: "ALL"
required: false
jobs:
package-cleanup:
if: inputs.run_package_cleanup || github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Delete old package versions
uses: actions/delete-package-versions@v5
with:
package-name: ${{ inputs.packages || 'sopseed,sopseed-chart/sopseed' }}
package-type: ${{ inputs.artifact_type || 'container' }}
min-versions-to-keep: ${{ inputs.keep_versions || '3' }}
token: ${{ secrets.GITHUB_TOKEN }}
actions-cleanup:
if: inputs.run_actions_cleanup || github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Delete old workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: ${{ inputs.retention_days || '90' }}
keep_minimum_runs: '1'
delete_workflow_by_state_pattern: ${{ inputs.workflow_states || 'ALL' }}