forked from grimme-lab/xtb
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.7 KB
/
stale_label.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
name: "Close Stale"
# The workflow triggers
on:
schedule:
- cron: '0 0 * * *'
issues:
types: [labeled]
pull_request:
types: [labeled]
# The stale workflow
jobs:
stale:
runs-on: ubuntu-latest
if: github.event.label.name == 'stale'
steps:
- name: Post stale message
uses: actions/github-script@v5
with:
script: |
const eventName = context.eventName;
const issueOrPrNumber = eventName === 'issues' ? context.payload.issue.number : context.payload.pull_request.number;
const message = eventName === 'issues' ?
"This issue is set to auto-close in 7 days if no further updates would be detected." :
"This PR is set to auto-close in 7 days if no further updates would be detected.";
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueOrPrNumber,
body: message
});
github-token: ${{ secrets.GITHUB_TOKEN }}
- name : Close Stale Items
uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: 'stale' # Label to detect
stale-pr-label: 'stale'
any-of-labels: 'stale'
days-before-stale: -1
days-before-close: 7
close-issue-message: 'This issue has been automatically closed due to inactivity.'
close-pr-message: 'This PR has been automatically closed due to inactivity.'