-
-
Notifications
You must be signed in to change notification settings - Fork 39
38 lines (33 loc) · 1.33 KB
/
orphaned-issues.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
name: "Close orphaned"
on:
issues:
types: [opened, edited]
jobs:
close_unchecked:
runs-on: ubuntu-latest
steps:
- name: Check if the issue has the checkbox checked
uses: actions/github-script@v6
with:
script: |
const body = context.payload.issue.body;
const issue_number = context.payload.issue.number;
const issue_owner = context.repo.owner;
const issue_repo = context.repo.repo;
// Check if the checkbox is checked in the issue description
const checkboxChecked = body.includes('- [x] I am willing to put in the work and submit a PR to resolve this issue.');
if (!checkboxChecked) {
// If checkbox is not checked, close the issue with a comment
github.rest.issues.createComment({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
body: "This issue has been automatically closed because the author did not indicate they are willing to put in the effort needed to resolve it."
});
github.rest.issues.update({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
state: "closed"
});
}