levibostian / action-conventional-pr-linter

Helps ensure that pull requests will be merged and creates the desired outcome of semantic-release.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub release (latest SemVer) GitHub release (latest SemVer including pre-releases)

action-conventional-pr-linter

GitHub Action that lints pull request titles to assert it conforms to a conventional commit spec.

Great Action if you use tools such as semantic-release. Merge all your PRs with confidence that the PR title is valid.

Features

  • Lint pull request titles to see if they match a conventional commit spec.
  • If pull request title not valid, print a human readable message to PR author helping them to fix the title themselves.

Note: At this time, this project only supports the conventional-commits spec. If your project uses something else (Angular, Atom, etc) then this Action will not work for you. See feature request to see how you can contribute to this project!

Getting started

You have 2 options:

1. Use reusable workflow if all you need is to lint the pull request titles

name: PR linter

on:
  pull_request:
    types: [opened, reopened, edited, synchronize, labeled]

jobs:
  lint-pr-title:
    uses: levibostian/action-conventional-pr-linter/.github/workflows/sharable-workflow.yml@v4
    permissions:
      pull-requests: write # github requires write permission when adding comments to an issue or pull request 

2. Use Action

  • Create your workflow
name: PR bot

on:
  pull_request:
    types: [opened, reopened, edited, synchronize, labeled]

jobs:
  pr-help:
    name: PR bot
    runs-on: ubuntu-latest
    permissions:
      pull-request: write # github requires write permission when adding comments to an issue or pull request 
    steps:
      - name: Lint PR title 
        uses: levibostian/action-conventional-pr-linter@v4
  • Create pull requests! The bot will run and comment on your pull requests if the PR title is not valid.

Development

  • npm install
  • npm run test to run automated tests

At this time, the Action does not have a lot of automated tests written. Instead, the Action is tested by running the Action on pull requests on this repository. Therefore, modify .github/workflows/test-action.yml to make sure that it will run successfully to test the Action on this repository.

Deployment

Appropriately, this project is deployed using semantic-release and the PR titles use the conventional commit format.

About

Helps ensure that pull requests will be merged and creates the desired outcome of semantic-release.

License:MIT License


Languages

Language:TypeScript 82.4%Language:Shell 15.0%Language:JavaScript 2.6%