Skip to content

Commit 7081d1a

Browse files
authored
Merge pull request #12329 from jsquyres/pr/auto-close-issues-bot
CI: Bot to mark abandoned Github Issues stale/closed
2 parents a55e9b2 + 80a69c1 commit 7081d1a

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# The idea behind this Action is to prevent the situation where a user
2+
# files a Github Issue, someone asks for clarification / more
3+
# information, but the original poster never provides the information.
4+
# The issue then becomes forgotten and abondoned.
5+
#
6+
# Instead of that scenario, Open MPI community members can assign a
7+
# label to Github Issues indicating that we're waiting for the user to
8+
# reply. If too much time elapses with no reply, mark the Issue as
9+
# stale and emit a warning that we'll close the issue if we continue
10+
# to receive no reply. If we timeout again with no reply after the
11+
# warning, close the Issue and emit a comment explaining why.
12+
#
13+
# If the user *does* reply, the label is removed, and this bot won't
14+
# touch the Issue. Specifically: this bot will never mark stale /
15+
# close an Issue that doesn't have the specified label.
16+
#
17+
# Additionally, we are *only* marking stale / auto-closing Github
18+
# Issues -- not Pull Requests.
19+
#
20+
# This is a cron-based Action that runs a few times a day, just so
21+
# that we don't mark stale / close a bunch of issues all at once.
22+
#
23+
# While the actions/stale bot Action used here is capable of removing
24+
# the label when a user replies to the Issue, we actually use a 2nd
25+
# Action (removing-awaiting-user-info-label.yaml) to remove the label.
26+
# We do this because that 2nd Action runs whenever a comment is
27+
# created -- not via cron. Hence, the 2nd Action will remove the
28+
# label effectively immediately when the user replies (vs. up to
29+
# several hours later).
30+
31+
name: Close stale issues
32+
on:
33+
schedule:
34+
# Run it a few times a day so as not to necessarily mark stale /
35+
# close a bunch of issues at once.
36+
- cron: '0 1,5,9,13,17,21 * * *'
37+
38+
jobs:
39+
stale:
40+
runs-on: ubuntu-latest
41+
steps:
42+
# https://github.com/marketplace/actions/close-stale-issues
43+
- uses: actions/stale@v9
44+
with:
45+
# If there are no replies for 14 days, mark the issue as
46+
# "stale" (and emit a warning).
47+
days-before-stale: 14
48+
# If there are no replies for 14 days after becoming stale,
49+
# then close the issue (and emit a message explaining why).
50+
days-before-close: 14
51+
52+
# Never close PRs
53+
days-before-pr-close: -1
54+
55+
# We only close issues with this label
56+
only-labels: "State: Awaiting user information"
57+
close-issue-label: Closed due to no reply
58+
59+
# Messages that we put in comments on issues
60+
stale-issue-message: |
61+
It looks like this issue is expecting a response, but hasn't gotten one yet. If there are no responses in the next 2 weeks, we'll assume that the issue has been abandoned and will close it.
62+
close-issue-message: |
63+
Per the above comment, it has been a month with no reply on this issue. It looks like this issue has been abandoned.
64+
65+
I'm going to close this issue. If I'm wrong and this issue is *not* abandoned, please feel free to re-open it. Thank you!
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This Action is run in conjunction with close-stale-issues.yaml. See
2+
# that file for a more complete description of how they work together.
3+
4+
name: 'Remove "State: Awaiting user information" label when there has been a reply'
5+
on:
6+
issue_comment:
7+
types:
8+
- created
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
# From
14+
# https://github.com/marketplace/actions/close-issues-after-no-reply:
15+
# only remove the label if someone replies to an issue who is not
16+
# an owner or collaborator on the repo.
17+
if: |
18+
github.event.comment.author_association != 'OWNER' &&
19+
github.event.comment.author_association != 'COLLABORATOR'
20+
steps:
21+
- name: 'Remove "State: Awaiting user information" label'
22+
uses: octokit/[email protected]
23+
continue-on-error: true
24+
with:
25+
route: DELETE /repos/:repository/issues/:issue/labels/:label
26+
repository: ${{ github.repository }}
27+
issue: ${{ github.event.issue.number }}
28+
label: "State: Awaiting user information"
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)