diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000000..7b9789b7f7 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,47 @@ +name: Conventional Commitlint + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + commitlint: + name: Commitlint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: lts/* + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build packages + run: yarn build + + - name: Print versions + run: | + git --version + node --version + npm --version + yarn --version + yarn commitlint --version + + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + run: yarn commitlint --last --verbose + + - name: Validate PR commits with commitlint + if: github.event_name == 'pull_request' + run: yarn commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose