Skip to content

Commit d2ebd0e

Browse files
authored
Refine issue-auto-close action.
1 parent fc0bde2 commit d2ebd0e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/auto_close_default_issues.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ jobs:
1313
script: |
1414
const issue = context.payload.issue;
1515
const body = issue.body || '';
16+
const title = issue.title || '';
17+
const textToCheck = (title + ' ' + body).toLowerCase();
1618
1719
// Check for specific fields from your custom form
18-
// Adjust these patterns based on your form structure
1920
const hasCustomFields = body.includes('### Describe bug') ||
2021
body.includes('### Simple code that reproduces');
2122
22-
if (!hasCustomFields) {
23+
// Check for bug-related keywords
24+
const bugKeywords = ['bug', 'problem', 'broken'];
25+
const looksBugReport = bugKeywords.some(keyword => textToCheck.includes(keyword));
26+
27+
// Only close if it looks like a bug report but doesn't use the template
28+
if (!hasCustomFields && looksBugReport) {
2329
await github.rest.issues.createComment({
2430
owner: context.repo.owner,
2531
repo: context.repo.repo,
2632
issue_number: issue.number,
27-
body: 'This issue appears to use the default template. If you are reporting a bug, then use our custom bug report form. If a feature request, then wait and we will revert the auto-close.'
33+
body: 'This issue appears to be a bug report but doesn\'t use our bug report template. Resubmit with our custom bug report form..'
2834
});
2935
3036
await github.rest.issues.update({

0 commit comments

Comments
 (0)