Skip to content

GitHub Action that validates the PR title and commits against a Conventional Commits preset.

Notifications You must be signed in to change notification settings

beemojs/conventional-pr-action

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

conventional-pr-action

GitHub Action that validates a pull request title against a Conventional Commits preset.

Setup

Create a .github/workflows/pr.yml file in your repository with the following contents. The GITHUB_TOKEN environment variable and latest actions are required.

name: PR
on: pull_request
jobs:
  conventional:
    name: Conventional PR
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - uses: beemojs/conventional-pr-action@v3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Supports the following input options:

  • auto-install - Automatically install dependencies and the preset npm package. Defaults to true.
  • config-preset - The conventional changelog config preset. Defaults to beemo.
  • config-version - The conventional changelog config preset package version to install. Defaults to latest.
  • require-multiple-commits - Validates the commits for use within squash merging. Defaults to false.

Choosing a preset

Conventional commits require a changelog preset, and this action defaults to conventional-changelog-beemo. If you'd like to use another preset, update the config-preset option.

- uses: beemojs/conventional-pr-action@v3
  with:
    config-preset: eslint

Furthermore, the preset must exist in node_modules for the action to work correctly. The action currently supports the following workflows:

Automatic installation

If the auto-install option is true (the default), the action will automatically install the preset at the root of the repository using your chosen package manager.

This will modify the working tree of your checkout!

Manual installation

If you don't want to use automatic installation, you'll need to disable the auto-install option, and add your chosen preset manually to devDependencies in the root package.json.

- uses: beemojs/conventional-pr-action@v3
  with:
    auto-install: false

About

GitHub Action that validates the PR title and commits against a Conventional Commits preset.

Resources

Stars

Watchers

Forks

Packages

No packages published