-
Notifications
You must be signed in to change notification settings - Fork 6
107 lines (101 loc) · 3.3 KB
/
Copy pathmaintenance.yml
File metadata and controls
107 lines (101 loc) · 3.3 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Maintenance
on:
schedule:
- cron: "0 22 * * 5" # Every friday 10 PM
pull_request:
types: [closed, opened, synchronize, reopened]
workflow_dispatch:
inputs:
branch:
description: 'Name of the Git branch'
required: true
default: 'main'
jobs:
close-stale:
name: "Close Stale Items"
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GH_TOKEN }}
days-before-issue-stale: 21
days-before-issue-close: 7
stale-issue-label: "stale"
days-before-pr-stale: 21
days-before-pr-close: 7
clean-cache:
name: "Cleanup Cache"
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v6
- name: "Run gh(auth)"
run: |
gh auth status
gh extension install actions/gh-actions-cache
- name: "Run gh-cleanup-cache.ps1"
run: |
$branch = "${{ github.event.pull_request.head.ref || github.event.inputs.branch }}"
./scripts/gh-cleanup-cache.ps1 -Branch "$branch"
shell: pwsh
clean-runs:
name: "Cleanup Runs"
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v6
- name: "Run gh(auth)"
run: |
gh auth status
- name: "Run gh-cleanup-runs.ps1"
run: |
$branch = "${{ github.event.pull_request.head.ref || github.event.inputs.branch }}"
./scripts/gh-cleanup-runs.ps1 -Branch "$branch" `
-Workflow "build.yml"
./scripts/gh-cleanup-runs.ps1 -Branch "$branch" `
-Workflow "build-windows-hosted.yml"
shell: pwsh
pr-labeler:
name: "Label Pull Requests"
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize')
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/labeler@v6
with:
configuration-path: '.github/label-configuration.yml'
sync-labels: true
pr-assign:
name: "Assign Pull Request"
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/github-script@v9
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Get the owner from CODEOWNERS or repository owner
const owner = context.repo.owner;
github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
reviewers: [owner]
});