Automatically close issues or pull requests whose body text does not match the specified regular expression pattern. This is useful to enforce usage of issue/PR templates.
To configure the action simply add the following lines to your .github/main.workflow workflow file:
name: Autocloser
on: [issues, pull_request]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Autoclose issues that did not follow issue template
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-close-message: "@${issue.user.login} this issue was automatically closed because it did not follow the issue template"
issue-pattern: ".*guidelines for Contributing.*"issue-close-message and pr-close-message are ES6-style template literals which will be evaluated with the issue or pull request
webhook payload in context. The example above uses ${issue.user.login} to get the author of the issue.
issuewebhook payload examplepull_requestwebhook payload example
issue-pattern and pr-pattern are strings which are compiled to JavaScript Regexps.