From 9c9be9ea9895a4719ddb5b262b0054d7a227f9c9 Mon Sep 17 00:00:00 2001 From: Patrice Bender Date: Thu, 26 Oct 2023 13:12:51 +0200 Subject: [PATCH] ci: add action to check for conventional commit messages (#281) adhering to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format is vital to make our automatic release process with [release please](https://www.npmjs.com/package/release-please/v/11.14.2) work. - Automatically generating CHANGELOGs. - Automatically determining a semantic version bump (based on the types of commits landed). - Communicating the nature of changes to teammates, the public, and other stakeholders. - Triggering build and publish processes. - Making it easier for people to contribute to our projects, by allowing them to explore a more structured commit history. I will make this action a mandatory one. To follow the conventional commit format you only have to begin your commit message with: ```md [optional scope]: [optional body] [optional footer(s)] ``` where `` is one of: ```js [ "feat", "fix", "docs", "style", "refactor", "test", "build", "perf", "ci", "chore", "revert", "merge", "wip", ] ``` 1. fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning). 2. feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning). 3. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. It is also possible to have multiple fixes and features in one commit message. Please consult the [conventional commits doc](https://www.conventionalcommits.org/en/v1.0.0/) --- .github/workflows/conventional-commits.yml | 38 ++++++++++++++++++++++ release-please-config.json | 5 +++ 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/conventional-commits.yml diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml new file mode 100644 index 000000000..b6f870be3 --- /dev/null +++ b/.github/workflows/conventional-commits.yml @@ -0,0 +1,38 @@ +name: 'Adheres to conventional commit standard' + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Configure which types are allowed (newline-delimited). + # Default: https://github.com/commitizen/conventional-commit-types + types: | + feat + fix + docs + style + refactor + perf + test + build + ci + chore + revert + wip + deps + diff --git a/release-please-config.json b/release-please-config.json index e0a8bad87..0f9c35b72 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -20,6 +20,11 @@ "type": "deps", "section": "Changed", "hidden": false + }, + { + "type": "perf", + "section": "Performance Improvements", + "hidden": false } ] }