From 27ec6fcb00ac93b0d123b342de22a469580936e2 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Wed, 25 Aug 2021 23:36:11 +0800 Subject: [PATCH] ci: run commitlint on PR title (#88) --- .github/workflows/commitlint.yml | 7 ++++++- commitlint.config.js | 1 + package.json | 1 + pnpm-lock.yaml | 4 +++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index fb82452cc..b9ab0fcc0 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,6 +1,8 @@ name: Commitlint -on: [pull_request] +on: + pull_request: + types: [opened, edited, synchronize, reopened] jobs: lint-commits: @@ -20,3 +22,6 @@ jobs: - name: Commitlint run: commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD + + - name: Commitlint on PR title + run: echo ${{ github.event.pull_request.title }} | commitlint diff --git a/commitlint.config.js b/commitlint.config.js index e90a52716..07a91268f 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,5 +1,6 @@ const { rules } = require('@commitlint/config-conventional'); +/** @type {import('@commitlint/types').UserConfig} **/ module.exports = { extends: ['@commitlint/config-conventional'], rules: { diff --git a/package.json b/package.json index f36ae3efc..fcb10b029 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "devDependencies": { "@commitlint/cli": "^13.1.0", "@commitlint/config-conventional": "^13.1.0", + "@commitlint/types": "^13.1.0", "husky": "^7.0.1", "lerna": "^4.0.0", "typescript": "^4.3.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35f8b7446..e457a4fb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,12 +6,14 @@ importers: specifiers: '@commitlint/cli': ^13.1.0 '@commitlint/config-conventional': ^13.1.0 + '@commitlint/types': ^13.1.0 husky: ^7.0.1 lerna: ^4.0.0 typescript: ^4.3.5 devDependencies: '@commitlint/cli': 13.1.0 '@commitlint/config-conventional': 13.1.0 + '@commitlint/types': 13.1.0 husky: 7.0.1 lerna: 4.0.0 typescript: 4.3.5 @@ -1660,7 +1662,7 @@ packages: resolution: {integrity: sha512-zcVjuT+OfKt8h91vhBxt05RMcTGEx6DM7Q9QZeuMbXFk6xgbsSEDMMapbJPA1bCZ81fa/1OQBijSYPrKvtt06g==} engines: {node: '>=v12'} dependencies: - chalk: 4.1.1 + chalk: 4.1.2 dev: true /@eslint/eslintrc/0.4.3: