Skip to content

GitHub action to automatically close issues/PRs that don't match a regexp

License

Notifications You must be signed in to change notification settings

roots/issue-closer-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub action to automatically close issues/PRs

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.

Installation

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.*"

Configuration

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.

issue-pattern and pr-pattern are strings which are compiled to JavaScript Regexps.

About

GitHub action to automatically close issues/PRs that don't match a regexp

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published