Files
cap/.github/workflows/auto-close-issues.yml
2026-02-08 16:10:36 +00:00

31 lines
1.1 KiB
YAML

name: Auto-close empty issues
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
close:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const body = context.payload.issue.body?.toLowerCase() ?? "";
console.log(context.payload.issue)
const badBody = body.includes("a clear and concise description of what the bug is")
if (badBody) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
state: "closed"
})
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: "this issue has been automatically closed due to it containing the description placeholder to prevent spam. if this isn't intentional, please re-open it with a proper body."
})
}