From cdaa8e21d95e0cb7fa3808e8f9d12f826dedc60c Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 21:56:51 -0600 Subject: [PATCH 1/6] ci: Add Conventional Commit Linter --- .commit-me.json | 4 ++ .github/workflows/conventional-commits.yaml | 32 +++++++++++++++ .../workflows/lint-conventional-commits.yaml | 39 +++++++++++++++++++ commitlint.config.js | 30 ++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 .commit-me.json create mode 100644 .github/workflows/conventional-commits.yaml create mode 100644 .github/workflows/lint-conventional-commits.yaml create mode 100644 commitlint.config.js diff --git a/.commit-me.json b/.commit-me.json new file mode 100644 index 000000000..428a40d1d --- /dev/null +++ b/.commit-me.json @@ -0,0 +1,4 @@ +{ + "include-pull-requests": true, + "types": [ "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "release", "squash", "test" ] +} diff --git a/.github/workflows/conventional-commits.yaml b/.github/workflows/conventional-commits.yaml new file mode 100644 index 000000000..5af7631f2 --- /dev/null +++ b/.github/workflows/conventional-commits.yaml @@ -0,0 +1,32 @@ +name: Conventional Commits Validation + +on: + workflow_dispatch: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + +permissions: + contents: read + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request + cancel-in-progress: true # Cancel any previous runs of this workflow + +jobs: + validate-commits: + name: Conventional Commits Validation + runs-on: ubuntu-latest + steps: + - uses: dev-build-deploy/commit-me@v1.3.1 + env: + FORCE_COLOR: 3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + include-commits: true + update-labels: false + config: ".commit-me.json" diff --git a/.github/workflows/lint-conventional-commits.yaml b/.github/workflows/lint-conventional-commits.yaml new file mode 100644 index 000000000..ef226f645 --- /dev/null +++ b/.github/workflows/lint-conventional-commits.yaml @@ -0,0 +1,39 @@ +name: "Lint Conventional Commits" +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request + cancel-in-progress: true # Cancel any previous runs of this workflow + +jobs: + main: + name: Lint Conventional Commits + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + name: "🤖 Check PR title follows conventional commit spec" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Have to specify all types because `maint` and `rel` aren't defaults + types: | + fix + feat + chore + ci + docs + style + refactor + perf + test + - uses: actions/checkout@v4.1.1 + - uses: wagoid/commitlint-github-action@v5.4.5 + name: "🤖 Check commit messages follow conventional commit spec" diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 000000000..1e2ffb534 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,30 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'subject-case': [ + 2, + 'never', + [ + 'upper-case', + 'pascal-case', + ] + ], + 'type-enum': [ + 2, + 'always', + [ + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'squash', + 'style', + 'test' + ] + ] + } +}; From c244b3c9dd51269c35dc04a86940abbff7671647 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Mon, 22 Jan 2024 06:59:27 -0600 Subject: [PATCH 2/6] squash: remove unused action --- .../workflows/lint-conventional-commits.yaml | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/lint-conventional-commits.yaml diff --git a/.github/workflows/lint-conventional-commits.yaml b/.github/workflows/lint-conventional-commits.yaml deleted file mode 100644 index ef226f645..000000000 --- a/.github/workflows/lint-conventional-commits.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: "Lint Conventional Commits" -on: - pull_request: - types: - - opened - - synchronize - - reopened - - edited - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request - cancel-in-progress: true # Cancel any previous runs of this workflow - -jobs: - main: - name: Lint Conventional Commits - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 - name: "🤖 Check PR title follows conventional commit spec" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # Have to specify all types because `maint` and `rel` aren't defaults - types: | - fix - feat - chore - ci - docs - style - refactor - perf - test - - uses: actions/checkout@v4.1.1 - - uses: wagoid/commitlint-github-action@v5.4.5 - name: "🤖 Check commit messages follow conventional commit spec" From 121b9a8b5a4e066138ccb277ba024c7a5db9e6ef Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Mon, 22 Jan 2024 07:04:02 -0600 Subject: [PATCH 3/6] squash: Delete commitlint.config.js --- commitlint.config.js | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 commitlint.config.js diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 1e2ffb534..000000000 --- a/commitlint.config.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'subject-case': [ - 2, - 'never', - [ - 'upper-case', - 'pascal-case', - ] - ], - 'type-enum': [ - 2, - 'always', - [ - 'chore', - 'ci', - 'docs', - 'feat', - 'fix', - 'perf', - 'refactor', - 'revert', - 'squash', - 'style', - 'test' - ] - ] - } -}; From 0dd88f1e82027095076cc6c8b060301392e2668f Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Mon, 22 Jan 2024 10:56:56 -0600 Subject: [PATCH 4/6] squash: PR feedback --- .commit-me.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.commit-me.json b/.commit-me.json index 428a40d1d..80224890c 100644 --- a/.commit-me.json +++ b/.commit-me.json @@ -1,4 +1,4 @@ { "include-pull-requests": true, - "types": [ "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "release", "squash", "test" ] + "types": [ "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "release", "revert", "squash", "style", "test" ] } From 8f1295d89672464331f96971f453c6efdf1fce94 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Mon, 22 Jan 2024 10:58:16 -0600 Subject: [PATCH 5/6] squash: Update contributing guide --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 91c827411..a8a5fe37b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -132,7 +132,7 @@ merging. All commits to the main repository should follow the [conventional commit](https://conventionalcommits.org) standard. In a nutshell, this means commit messages should begin with a semantic tag such as `feat:`, -`fix:`, `docs:`, `tests:`, or `refactor:`. Our release tooling uses these tags +`fix:`, `docs:`, `test:`, `refactor:`, etc... Our release tooling uses these tags to determine the semantics of your commit, such as how it affects semantic versioning of the libraries, and to generate changelogs from commit descriptions. If you are not familiar with conventional commits, please review From 49ba8eabcb0a05c5a1b1920615dc82ba7281f621 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Thu, 25 Jan 2024 08:14:25 -0600 Subject: [PATCH 6/6] squash: PR Feedback --- .github/workflows/conventional-commits.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conventional-commits.yaml b/.github/workflows/conventional-commits.yaml index 5af7631f2..cc3a3ef71 100644 --- a/.github/workflows/conventional-commits.yaml +++ b/.github/workflows/conventional-commits.yaml @@ -27,6 +27,6 @@ jobs: FORCE_COLOR: 3 with: token: ${{ secrets.GITHUB_TOKEN }} - include-commits: true + include-commits: false update-labels: false config: ".commit-me.json"