Skip to content

Commit 4212c78

Browse files
authored
Perform automatic actions on issues and pull requests (#942)
* Add the "new" label to newly created issues. * Mark inactive issues and PRs as "stalled" after a certain period. * Close inactive issues and PRs after a certain period.
1 parent 0eb8c1a commit 4212c78

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Close inactive issues and PRs
2+
on:
3+
schedule:
4+
- cron: "30 1 * * *"
5+
workflow_dispatch:
6+
permissions: read-all
7+
jobs:
8+
close-issues:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
steps:
14+
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
15+
with:
16+
only-labels: "status: waiting-for-feedback" # only consider issues and PRs with this label
17+
days-before-stale: 30 # 1 month
18+
days-before-close: 60 # 2 months after being stale
19+
stale-issue-label: "status: stale"
20+
stale-pr-label: "status: stale"
21+
stale-issue-message: >
22+
This issue has been inactive for a while. If you’re still interested, let us know how we can help! Our community is small, and we need contributors like you.
23+
If we don’t hear back, we may close it, but you’re always welcome to reopen it. Let’s build this together! 🚀
24+
close-issue-message: >
25+
Closing this issue due to inactivity. If you’re still interested, let us know! Our community is small, and we need contributors like you.
26+
If you provide more details or take the lead on a solution, we’ll be happy to re-open it. Let’s build this together! 🚀
27+
stale-pr-message: >
28+
This PR has been inactive for a while. If you’re still working on it, let us know how we can help! Our community is small, and we need contributors like you.
29+
If we don’t hear back, we may close it, but you’re always welcome to reopen it. Let’s build this together! 🚀
30+
close-pr-message: >
31+
Closing this PR due to inactivity. If you’d like to continue, let us know! Our community is small, and we need contributors like you.
32+
Feel free to re-open this PR or submit a new one when you’re ready. Let’s build this together! 🚀
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Add label to opened issues
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
permissions: read-all
7+
jobs:
8+
label_issues:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
steps:
13+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
14+
with:
15+
script: |
16+
const issue = await github.rest.issues.get({
17+
issue_number: context.issue.number,
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
});
21+
const originalLabels = issue.data.labels.map(l => l.name);
22+
const statusLabels = originalLabels.filter(l => l.startsWith("status: "));
23+
if (statusLabels.length === 0) {
24+
github.rest.issues.addLabels({
25+
issue_number: context.issue.number,
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
labels: ["status: new"]
29+
})
30+
}

0 commit comments

Comments
 (0)