From 280877a77b6662e1cfcc8f4255f82789304957d0 Mon Sep 17 00:00:00 2001 From: r34son Date: Sat, 14 Oct 2023 18:28:46 +0300 Subject: [PATCH] ci: added commitlint check --- .github/workflows/ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 375a355..d0f3463 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,15 @@ on: branches: ['master'] jobs: - unit: + validate: + name: Validate runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2 @@ -26,6 +29,22 @@ jobs: - name: Install dependencies run: pnpm install + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' + run: | + pnpm exec commitlint \ + --from ${{ github.event.before }} \ + --to ${{ github.event.after }} \ + --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: | + pnpm exec commitlint \ + --from ${{ github.event.pull_request.base.sha }} \ + --to ${{ github.event.pull_request.head.sha }} \ + --verbose + - name: Run the tests and generate coverage report run: pnpm test -- --coverage