Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
alert-triangle

GitHub Action

issue-validator

v0.4.0

issue-validator

alert-triangle

issue-validator

auto close issue if it does not meet the conditions

Installation

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

              

- name: issue-validator

uses: Okabe-Junya/[email protected]

Learn more about this action in Okabe-Junya/issue-validator

Choose a version

issue validator

license test eslint CodeQL

About

This is a simple issue validator github action that checks if the issue/pr title and body are valid.

Usage

Inputs

Input Name Description Required Default Value
title Title for the issue/pr. No ''
body Body for the issue/pr. No ''
title-regex-flags Regex flags for title. Use regex by setting to "true". No 'false'
body-regex-flags Regex flags for body. Use regex by setting to "true". No 'false'
issue-type Validate for issue or pull request. Default is "issue". No 'issue'
is-auto-close Auto close issue if not meeting conditions. No 'false'
is-match If set to "true", the title and body must match the condition. If set to "false", the title and body must not match the condition. No 'true'

Outputs

Output Name Description
result Result of validation.

RegExp

If you want to use regular expressions, set title-regex-flags and body-regex-flags to "true".

issue-validator uses the RegExp object to validate the title and body, so you can use the same syntax as the RegExp object.

document: MDN web docs

Example

When created a new issue/pr with the title starting with SPAM, the issue/pr will be closed automatically.

name: issue validator
on:
  workflow_dispatch:
  issues:
    types: [opened, edited]

permissions:
  issues: write

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: Okabe-Junya/issue-validator@latest
        with:
          title: '^SPAM'
          is-auto-close: 'true'
          issue-type: 'both'
          github-token: ${{ secrets.GITHUB_TOKEN }}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Thank you for considering contributing to this project.

When contributing to this repository, please first discuss the change you wish to make via issue before making a change.