[bug] #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." | |
| }) | |
| } |