Skip to content

Commit a7cd6bd

Browse files
feat: action for labeling and closing stale PRs (#17041)
Per discussion in the maintainer channel. Uses a PR branch actions/stale#1145 of [actions/stale](https://github.com/actions/stale/) since it has a feature that will allow us to only consider PRs not sitting on the [#queue](https://bit.ly/3Ymuh0U). There's still placeholder text for the comments, but this is intended to be merged with the `debug-only` flag until we have the kinks sorted out, so we could fill in that text in a later PR.
1 parent 1aaa5b9 commit a7cd6bd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/stale.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Close stale issues and PRs'
2+
on:
3+
schedule:
4+
- cron: '30 1 * * *' # every day at 01:30 UTC
5+
workflow_dispatch:
6+
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# until https://github.com/actions/stale/pull/1145 is merged
12+
- uses: asterisk/github-actions-stale@main-only-matching-filter
13+
with:
14+
debug-only: 'true' # TODO: remove in follow-up PR after testing is done!
15+
stale-pr-label: 'stale'
16+
stale-pr-message: 'Message to comment on stale PRs.'
17+
close-pr-label: 'closed-due-to-inactivity'
18+
close-pr-message: 'Comment on the staled PRs while closed'
19+
days-before-stale: 60
20+
days-before-close: 120
21+
# search string from the Zulip #queue link at https://bit.ly/4eo6brN
22+
# "is:open is:pr -is:draft base:master sort:updated-asc status:success -label:blocked-by-other-PR -label:merge-conflict -label:awaiting-CI -label:WIP -label:awaiting-author -label:delegated -label:auto-merge-after-CI -label:ready-to-merge -label:please-adopt -label:help-wanted -label:awaiting-zulip"
23+
# We want PRs _not_ on the queue, so we keep "is:pr -is:draft base:master" (is:open is added by the action by default) as a prefix for all queries and then negate the rest of the params in separate queries to simulate boolean OR (see https://github.com/actions/stale/pull/1145)
24+
# except for label:auto-merge-after-CI and label:ready-to-merge which presumably will be noticed before they go stale
25+
only-matching-filter: '[ "is:pr -is:draft base:master -status:success", "is:pr -is:draft base:master label:blocked-by-other-PR", "is:pr -is:draft base:master label:merge-conflict", "is:pr -is:draft base:master label:awaiting-CI", "is:pr -is:draft base:master label:WIP", "is:pr -is:draft base:master label:awaiting-author", "is:pr -is:draft base:master label:delegated", "is:pr -is:draft base:master label:please-adopt", "is:pr -is:draft base:master label:help-wanted", "is:pr -is:draft base:master label:awaiting-zulip" ]'

0 commit comments

Comments
 (0)