Skip to content

Commit 40d72a3

Browse files
authored
chore: add commitlint workflow (#9409)
* chore: add commitlint workflow * chore: exit 1 on fail * chore: use builtin helpurl
1 parent d97fa95 commit 40d72a3

4 files changed

Lines changed: 866 additions & 5 deletions

File tree

.github/workflows/conventional-label.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,28 @@ on:
33
types:
44
- opened
55
- edited
6-
name: conventional-release-labels
6+
name: commit lint & label
77
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: read
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Setup node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: lts/*
21+
cache: npm
22+
- name: Install dependencies
23+
run: npm ci
24+
- name: Check PR title
25+
id: check-pr-title
26+
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --verbose
27+
828
label:
929
runs-on: ubuntu-latest
1030
permissions:

commitlint.config.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license
3+
* Copyright 2018 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* Rules configuration for commitlint.
9+
* https://commitlint.js.org/reference/rules.html#subject-full-stop
10+
*
11+
* Extends the conventional-commit spec at
12+
* https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional
13+
*/
14+
15+
export default {
16+
extends: ['@commitlint/config-conventional'],
17+
rules: {
18+
// Warn if not in this list. Allow for judicious creativity.
19+
'type-enum': [
20+
1,
21+
'always',
22+
[
23+
'build',
24+
'chore',
25+
'ci',
26+
'docs',
27+
'feat',
28+
'fix',
29+
'refactor',
30+
'release',
31+
'revert',
32+
'test',
33+
],
34+
],
35+
'subject-case': [0],
36+
},
37+
helpUrl:
38+
'https://developers.google.com/blockly/guides/contribute/get-started/commits',
39+
};

0 commit comments

Comments
 (0)