diff --git a/.github/workflows/check-commit-message.yml b/.github/workflows/check-commit-message.yml new file mode 100644 index 0000000..937db75 --- /dev/null +++ b/.github/workflows/check-commit-message.yml @@ -0,0 +1,27 @@ +name: 'Check Commit Message' + +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + push: + branches: + - master + +jobs: + check-commit-message: + name: Check Commit Message + runs-on: ubuntu-latest + steps: + - name: Commit begins with supported commit type + uses: gsactions/commit-message-checker@v1 + with: + pattern: '^(feat|fix|docs|style|refactor|test|chore).+' + error: 'Commit messages must begin with a valid commit type. See "Commit Style" under CONTRIBUTING.md for more details.' + excludeDescription: 'true' + excludeTitle: 'true' + checkAllCommitMessages: 'true' + accessToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 278100a..31e97b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,13 +8,26 @@ - Assign a [sparkboxer][contributors] to review your PR ## Commit Style -We use [Conventional Commits] and [Standard Version] to automate versioning of this package. Commit messages must be prefixed with a valid commit type. +We use [Conventional Commits] and [Standard Version] to automate versioning of this package. Commit messages must be prefixed with a valid commit type and the commit type cannot be prefixed with any additional text. + +Supported commit types include `feat`, `fix`, `docs`, `style`, `refactor`, and `test`. + +Valid example: -Example: ```sh feat: add new linting rule for ... ``` +Invalid examples: + +```sh + feature: add new linting rule for ... + ``` + + ```sh + :sparkles: feat: add new linting rule for ... + ``` + ℹ️ See the [Conventional Commits] page for further details on available commit types and how to handle breaking changes. ## Creating a Release