mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
auto close issue on empty/bad title
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
name: Close untitled issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-title:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
steps:
|
||||||
|
- name: Close if title is empty or generic
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const title = context.payload.issue.title.trim();
|
||||||
|
const badTitles = [
|
||||||
|
"[bug]",
|
||||||
|
"bug report",
|
||||||
|
"bug",
|
||||||
|
"issue",
|
||||||
|
];
|
||||||
|
|
||||||
|
if (badTitles.includes(title.toLowerCase())) {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.payload.issue.number,
|
||||||
|
body: "This issue was closed because no title was provided. Please re-open with a descriptive title that summarizes the problem."
|
||||||
|
});
|
||||||
|
|
||||||
|
await github.rest.issues.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.payload.issue.number,
|
||||||
|
state: "closed",
|
||||||
|
state_reason: "not_planned"
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user