Skip to content

Commit 1662e89

Browse files
mhdawsonMoLow
authored andcommitted
build: add action to close stale PRs
Add action to close PRs that are over 1 year old and have had no comments or updates in the last 6 months. Fixes: nodejs#42981 Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: nodejs#48051 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 709e368 commit 1662e89

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Close stale feature requests
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
endDate:
6+
description: stop processing PRs after this date
7+
required: false
8+
type: string
9+
schedule:
10+
# Run every day at 1:00 AM UTC.
11+
- cron: 0 1 * * *
12+
13+
# yamllint disable rule:empty-lines
14+
env:
15+
CLOSE_MESSAGE: >
16+
This pull request was opened more than a year ago and there has
17+
been no activity in the last 6 months. We value your contribution
18+
but since it has not progressed in the last 6 months it is being
19+
closed. If you feel closing this pull request is not the right thing
20+
to do, please leave a comment.
21+
22+
WARN_MESSAGE: >
23+
This pull request was opened more than a year ago and there has
24+
been no activity in the last 5 months. We value your contribution
25+
but since it has not progressed in the last 5 months it is being
26+
marked stale and will be closed if there is no progress in the
27+
next month. If you feel that is not the right thing to do please
28+
comment on the pull request.
29+
# yamllint enable
30+
31+
permissions:
32+
contents: read
33+
34+
jobs:
35+
stale:
36+
permissions:
37+
pull-requests: write # for actions/stale to close stale PRs
38+
if: github.repository == 'nodejs/node'
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Set default end date which is 1 year ago
42+
run: echo "END_DATE=$(date --date='525600 minutes ago' --rfc-2822)" >> "$GITHUB_ENV"
43+
- name: if date set in event override the default end date
44+
env:
45+
END_DATE_INPUT_VALUE: ${{ github.event.inputs.endDate }}
46+
if: ${{ github.event.inputs.endDate != '' }}
47+
run: echo "END_DATE=$END_DATE_INPUT_VALUE" >> "$GITHUB_ENV"
48+
- uses: mhdawson/stale@453d6581568dc43dbe345757f24408d7b451c651 # PR to add support for endDate
49+
with:
50+
repo-token: ${{ secrets.GITHUB_TOKEN }}
51+
end-date: ${{ env.END_DATE }}
52+
days-before-issue-stale: -1
53+
days-before-issue-close: -1
54+
only-labels: test-stale-pr
55+
days-before-stale: 150
56+
days-before-close: 30
57+
stale-issue-label: stale
58+
close-issue-message: ${{ env.CLOSE_MESSAGE }}
59+
stale-issue-message: ${{ env.WARN_MESSAGE }}
60+
exempt-pr-labels: never-stale
61+
# max requests it will send per run to the GitHub API before it deliberately exits to avoid hitting API rate limits
62+
operations-per-run: 500
63+
remove-stale-when-updated: true

0 commit comments

Comments
 (0)