Skip to content
check-square

GitHub Action

PR Linter

1.0.1 Latest version

PR Linter

check-square

PR Linter

Lint PR before merging

Installation

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

              

- name: PR Linter

uses: yogevbd/[email protected]

Learn more about this action in yogevbd/pr-lint-action

Choose a version

PR Lint Action

Lint PR before merging. Usefull for generating automatic changelog and release notes with github-release-notes

Example usage

Create .github/workflows/lint-pr.yml containing:

name: Lint PR

on:
  pull_request:
    types: [labeled, unlabeled, opened, edited]

jobs:
  lint-pr:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        ref: ${{ secrets.GITHUB_REF }}
    - uses: yogevbd/pr-lint-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Add pr-lint.config.js file to your main folder:

module.exports = {
  validLabels: [
    "bug",
    "skip-changelog",
    "enhancement",
    "feature"
  ],
  mandatorySections: [
    {
      beginsWith: "Changelog",
      endsWith: "End of changelog",
      message: "Changelog section is mandatory",
      validate: (section) => {
        return true;
      }
    }
  ]
}