-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (49 loc) · 1.45 KB
/
Copy pathworkflow-cleanup.yml
File metadata and controls
54 lines (49 loc) · 1.45 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
48
49
50
51
52
53
54
name: cleanup-workflow-runs
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 0 * * *" # GMT
workflow_dispatch:
inputs:
days_to_keep:
description: "Number of days to keep workflow runs"
required: false
default: "30"
type: string
delete_cancelled:
description: "Delete cancelled workflow runs"
required: false
default: true
type: boolean
delete_skipped:
description: "Delete skipped workflow runs"
required: false
default: true
type: boolean
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
{
echo "DAYS_TO_KEEP=${{ github.event.inputs.days_to_keep || '5' }}"
echo "DELETE_CANCELLED=${{ github.event.inputs.delete_cancelled || 'true' }}"
echo "DELETE_SKIPPED=${{ github.event.inputs.delete_skipped || 'true' }}"
} >> "$GITHUB_ENV"
- name: Cleanup of obsolete workflow runs
uses: actions/github-script@v9
with:
script: |
const script = require("./.github/actions/workflow-cleanup/index.js")
await script({
github,
context,
core,
exec,
env: process.env
});