Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
964 B

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',
});
}