Skip to content

Github PR title checker using Conventional Commits spec on Changesets

License

Notifications You must be signed in to change notification settings

philips-forks/prlint

 
 

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-esm.config.js
          useDescription: true # if to take into account the PR description of not, defaults to false
          convertToCJS: true

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'

useDescription

Optional if to take into account the PR description of not, default: false

convertToCJS

Optional converts the config file from ESM to CJS , default: false

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

ESM support is now optional via convertToCJS input and assumes js (or mjs) config files (not yaml/json)

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

About

Github PR title checker using Conventional Commits spec on Changesets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 89.9%
  • JavaScript 8.9%
  • Shell 1.2%