From cf4024a3a38be213888c895ee5e2f2d8dfa52bdd Mon Sep 17 00:00:00 2001 From: Artsiom Koltun Date: Tue, 18 Jul 2023 15:27:20 +0200 Subject: [PATCH] ci: enable commitlinter with conventional rules Signed-off-by: Artsiom Koltun --- .commitlintrc.json | 6 ++++++ .github/workflows/commitlint.yml | 26 ++++++++++++++++++++++++++ .github/workflows/linters.yml | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 .commitlintrc.json create mode 100644 .github/workflows/commitlint.yml diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..c9c5278 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,6 @@ +{ + "extends": [ + "@commitlint/config-conventional" + ] +} + diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..5385472 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,26 @@ +name: Commitlint + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + commitlint: + if: ${{ github.event.pull_request.merged != true }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 20.x + - name: Install dependencies + run: npm i -g @commitlint/cli @commitlint/config-conventional + - name: Validate all commits from PR + run: commitlint --config ./.commitlintrc.json --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 14a9a1b..07fd6eb 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -55,3 +55,19 @@ jobs: - uses: golangci/golangci-lint-action@v3 with: working-directory: . + + commitlint: + if: ${{ github.event.pull_request.merged != true }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 20.x + - name: Install dependencies + run: npm i -g @commitlint/cli @commitlint/config-conventional + - name: Validate all commits from PR + run: commitlint --config ./.commitlintrc.json --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose