From 22281def8fbbe90ccfe0ad1ccffdff7b4c799be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Murta?= Date: Sat, 21 Jun 2025 19:41:58 +0100 Subject: [PATCH] ci: add commitlint action To check that commits are according to the Conventional Commits spec. https://www.conventionalcommits.org/en/v1.0.0/ --- .commitlintrc.yaml | 28 ++++++++++++++++++++++++++++ .github/workflows/lint-pr.yaml | 20 ++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .commitlintrc.yaml create mode 100644 .github/workflows/lint-pr.yaml diff --git a/.commitlintrc.yaml b/.commitlintrc.yaml new file mode 100644 index 0000000..522602e --- /dev/null +++ b/.commitlintrc.yaml @@ -0,0 +1,28 @@ +--- +# The rules below have been manually copied from @commitlint/config-conventional +# and match the v1.0.0 specification: +# https://www.conventionalcommits.org/en/v1.0.0/#specification +# +# You can remove them and uncomment the config below when the following issue is +# fixed: https://github.com/conventional-changelog/commitlint/issues/613 +# +# extends: +# - '@commitlint/config-conventional' +rules: + body-leading-blank: [1, always] + body-max-line-length: [2, always, 100] + footer-leading-blank: [1, always] + footer-max-line-length: [2, always, 100] + header-max-length: [2, always, 100] + subject-case: + - 2 + - never + - [sentence-case, start-case, pascal-case, upper-case] + subject-empty: [2, never] + subject-full-stop: [2, never, "."] + type-case: [2, always, lower-case] + type-empty: [2, never] + type-enum: + - 2 + - always + - [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] diff --git a/.github/workflows/lint-pr.yaml b/.github/workflows/lint-pr.yaml new file mode 100644 index 0000000..17db916 --- /dev/null +++ b/.github/workflows/lint-pr.yaml @@ -0,0 +1,20 @@ +name: Lint PR + +on: + pull_request: + branches: ["main"] + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - run: >- + npx + commitlint + --from ${{ gitea.event.pull_request.base.sha }} + --to ${{ gitea.event.pull_request.head.sha }} + --verbose