Skip to content

Github action to enforce conventional commits against multiple commits within a single PR

License

Notifications You must be signed in to change notification settings

matmar10/prcolinter

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

Prcolinter

Easily lint each commit for your PRs against the Conventional Commit spec based on configurable Linter rules.

Brew up a stronger commit history!

Quick Start

name: Conventional Commit

on:
  pull_request:
    branches: [ '*' ]

jobs:
  lint-commits:
    steps:
      - uses: actions/checkout@v2
      - uses: matmar10/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

Custom rules

By default, it uses @commitlint/config-conventional rules.

Add a JSON file under .github/prcolinterrc.json to define your customer rules:

{
  "rules": {
    "body-max-line-length": [2, "always", 300],
  }  
}

-- or --

You can use or customize any of the Commitlint rules listed here

You can also define custom rules inline:

name: Conventional Commit

on:
  pull_request:
    branches: [ '*' ]

jobs:
  lint-commits:
    steps:
      - uses: actions/checkout@v2
      - uses: matmar10/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          # NOTE: the use of a string, not an object because github doesn't support objects as args
          rules: '{"body-max-line-length": [2, "always", 300]}'

Debug

You can see verbose log output by adding a Github secret on ACTIONS_STEP_DEBUG to true

About

Github action to enforce conventional commits against multiple commits within a single PR

Resources

License

Stars

Watchers

Forks

Packages

No packages published