chore(ci): add nx scope linting for pr title (#2781)
This commit is contained in:
parent
3e778a88dc
commit
d0d804631c
12
.github/workflows/lint_pr.yml
vendored
12
.github/workflows/lint_pr.yml
vendored
@ -8,14 +8,16 @@ jobs:
|
||||
lint_pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Use Node.js 16
|
||||
id: Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.14.0
|
||||
- name: Install commitlint cli and config
|
||||
run: npm install @commitlint/cli @commitlint/config-conventional
|
||||
- name: Create config
|
||||
run: echo "module.exports = {extends:['@commitlint/config-conventional']};" > commitlint.config.js
|
||||
- name: Install root dependencies
|
||||
run: yarn install
|
||||
- name: Check PR title
|
||||
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
|
||||
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js
|
||||
|
13
commitlint.config-ci.js
Normal file
13
commitlint.config-ci.js
Normal file
@ -0,0 +1,13 @@
|
||||
const { utils } = require('@commitlint/config-nx-scopes');
|
||||
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'],
|
||||
rules: {
|
||||
'scope-empty': [2, 'never'],
|
||||
'scope-enum': async (ctx) => [
|
||||
2,
|
||||
'always',
|
||||
['ci', 'docs', ...(await utils.getProjects(ctx))],
|
||||
],
|
||||
},
|
||||
};
|
@ -95,6 +95,7 @@
|
||||
"@babel/preset-typescript": "7.12.13",
|
||||
"@commitlint/cli": "^16.2.4",
|
||||
"@commitlint/config-conventional": "^16.2.4",
|
||||
"@commitlint/config-nx-scopes": "^17.4.2",
|
||||
"@cypress/grep": "^3.1.0",
|
||||
"@ethersproject/experimental": "^5.6.0",
|
||||
"@graphql-codegen/cli": "^2.11.8",
|
||||
|
@ -1618,6 +1618,11 @@
|
||||
dependencies:
|
||||
conventional-changelog-conventionalcommits "^4.3.1"
|
||||
|
||||
"@commitlint/config-nx-scopes@^17.4.2":
|
||||
version "17.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@commitlint/config-nx-scopes/-/config-nx-scopes-17.4.2.tgz#365feba8d5f935517d4387381b8c90289a8596c7"
|
||||
integrity sha512-xNbbLfFxK+U0LJv99PNP+qe1c3J8Q76gdtz9JIcUJL8FsRV5dDdxvYplNAs88WqCFViP0ipNTYljyigftr3nqg==
|
||||
|
||||
"@commitlint/config-validator@^16.2.1":
|
||||
version "16.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@commitlint/config-validator/-/config-validator-16.2.1.tgz#794e769afd4756e4cf1bfd823b6612932e39c56d"
|
||||
|
Loading…
Reference in New Issue
Block a user