-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (47 loc) · 1.7 KB
/
cleanup.yaml
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
name: Clean Up Repository
on:
workflow_dispatch:
schedule:
# Runs at midnight UTC every day
- cron: '0 0 * * *'
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Clean stale pull requests and issues
uses: actions/stale@v9
with:
days-before-stale: 7
days-before-close: 1
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.'
delete-branch: false # This deletes the branch that the PR was created from
- name: Delete old Clean Up workflows
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 0
delete_workflow_pattern: 'Clean Up Repository' # Target specific workflows
- name: Delete old Sil-Testing workflows
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 1
delete_workflow_pattern: 'Sil-Testing' # Target specific workflows
- name: Delete old branches
uses: beatlabs/[email protected]
with:
repo_token: ${{ github.token }}
date: '7 days ago'
default_branches: Golden_workflow,stage,main # Adjust the protected branches as necessary
dry_run: false