Skip to content

Github PR title checker using Conventional Commits spec on Changesets

License

Notifications You must be signed in to change notification settings

kevintyj/prlint

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

Prlint

Github PR title checker using Conventional Commits spec on Changesets


Github CI tests Github Build & Publish tests Latest Release codecov

Getting started

Use as a standalone action

Use Prlint with any github repository with the latest release. Checking out the repository is required to fetch the commitlint.config.js

Sample github actions file using PNPM: prlint.yml

name: 📝 Lint PR title
on:
  pull_request:
    types: [opened, edited, reopened, synchronize]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: 🔖Checkout repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: 📦Setup PNPM
        uses: pnpm/action-setup@v2
        with:
          version: 8
      - name: 🌳Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 20
          cache: pnpm
      - name: 🛠️Install dependencies for prlint
        run: pnpm install @commitlint/config-conventional
      - name: 📝Validate PR title with commitlint
        uses: kevintyj/prlint@v1
        # Optional
        with:
          cl-config: commitlint-cjs.config.cjs

The above action only check's out the current repository to fetch the commitlint configuration file. PNPM and node is used to install necessary dependencies, then config-conventional is used as a default config. When using the above configuration, pnpm-lock.yaml is required. Please use npm and node if package-lock.json is used.

Inputs

cl-config

Optional Path to commit lint config. Default : 'commitlint.config.js'

Outputs

lint-status

Status of the lint result. Returns ✅ Commitlint tests passed! if successful and ❌ Commitlint tests failed if linter tests fail.

lint-details

Output of the commitlint result.

Limitations

The current action of Prlint only accepts javascript based configurations on commitlint. v1.0.1 introduced support for ESM based configuration files. v1.1.0 introduced support for custom config file names. However, due to ESM support added in v1.0.1 non js config files such as yaml or json is not supported.

Even if the project does not use config-conventional, the Prlint uses the configuration as a fallback, therefore the project must contain the config-conventional package as a development dependency.

Changelog

See CHANGELOG for the release details

License

Licensed under the BSD-3 License, Copyright © 2023-present Kevin Taeyoon Jin.

See LICENSE for more information