mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-11 11:43:58 +02:00
Close empty issues
This commit is contained in:
29
.github/workflows/close-empty-issue.yml
vendored
Normal file
29
.github/workflows/close-empty-issue.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Close Issue if Empty
|
||||
on:
|
||||
issues:
|
||||
types: [ opened, edited ]
|
||||
jobs:
|
||||
close-empty-issue:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close Issue if Empty
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const issue = context.payload.issue;
|
||||
if (issue.body.trim() === '') {
|
||||
await github.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: 'Closing this issue because it is empty. Feel free to reopen with more details if you have any questions or need help.',
|
||||
});
|
||||
|
||||
await github.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user