Skip to content
alert-circle

GitHub Action

Issue title checker

v1.0 Latest version

Issue title checker

alert-circle

Issue title checker

Automatically closes issues if the title matches a specified regular expression

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Issue title checker

uses: IndyV/IssueChecker@v1.0

Learn more about this action in IndyV/IssueChecker

Choose a version

IssueChecker

Automatically close issues whose title match the specified regex.

Changes

This is a modified version of https://github.com/roots/issue-closer-action.

For my use case I needed the application to check the issue title. I need it to prevent issue spam from a site which follows a certain format.

Installation

To configure the action simply add the following lines to your .github/main.workflow workflow file:

name: Autocloser
on: [issues]
jobs:
  autoclose:
    runs-on: ubuntu-latest
    steps:
    - name: Autoclose issues whose title matched the specified regex
      uses: IndyV/IssueChecker@v1.0
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        issue-close-message: "@${issue.user.login} this issue was automatically closed because it matched a spam regex"
        issue-pattern: ".*guidelines for Contributing.*"

Configuration

issue-close-message is an ES6-style template literal which will be evaluated with the issue webhook payload in context. The example above uses ${issue.user.login} to get the author of the issue.

issue-pattern is a string which is compiled to JavaScript Regexps.