mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 19:50:45 +00:00
ci: add commit linter to GitHub Actions
This commit is contained in:
35
.github/workflows/commitlint.config.js
vendored
Normal file
35
.github/workflows/commitlint.config.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
'body-leading-blank': [1, 'always'],
|
||||||
|
'body-max-line-length': [2, 'always', 100],
|
||||||
|
'footer-leading-blank': [1, 'always'],
|
||||||
|
'footer-max-line-length': [2, 'always', 100],
|
||||||
|
'header-max-length': [2, 'always', 100],
|
||||||
|
'scope-case': [2, 'always', 'lower-case'],
|
||||||
|
'subject-case': [
|
||||||
|
2,
|
||||||
|
'never',
|
||||||
|
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
|
||||||
|
],
|
||||||
|
'subject-empty': [2, 'never'],
|
||||||
|
'subject-full-stop': [2, 'never', '.'],
|
||||||
|
'type-case': [2, 'always', 'lower-case'],
|
||||||
|
'type-empty': [2, 'never'],
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'build',
|
||||||
|
'chore',
|
||||||
|
'ci',
|
||||||
|
'docs',
|
||||||
|
'feat',
|
||||||
|
'fix',
|
||||||
|
'perf',
|
||||||
|
'refactor',
|
||||||
|
'revert',
|
||||||
|
'test',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
28
.github/workflows/commitlint.config_patch.js
vendored
Normal file
28
.github/workflows/commitlint.config_patch.js
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
module.exports = {
|
||||||
|
parserPreset: {
|
||||||
|
parserOpts: { headerPattern: /^([^\(\):]*)(?:\((.*)\))?!?:(.*)$/ }
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'body-leading-blank': [1, 'always'],
|
||||||
|
'body-max-line-length': [2, 'always', 100],
|
||||||
|
'footer-leading-blank': [1, 'always'],
|
||||||
|
'footer-max-line-length': [2, 'always', 100],
|
||||||
|
'scope-case': [2, 'always', 'lower-case'],
|
||||||
|
'subject-case': [
|
||||||
|
2,
|
||||||
|
'never',
|
||||||
|
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
|
||||||
|
],
|
||||||
|
'subject-empty': [2, 'never'],
|
||||||
|
'subject-full-stop': [2, 'never', '.'],
|
||||||
|
'type-case': [2, 'always', 'lower-case'],
|
||||||
|
'type-empty': [2, 'never'],
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'vim-patch',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
18
.github/workflows/commitlint.yml
vendored
Normal file
18
.github/workflows/commitlint.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: "Commit Linter"
|
||||||
|
on: pull_request
|
||||||
|
jobs:
|
||||||
|
lint-commits:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- run: npm install --save-dev @commitlint/cli
|
||||||
|
- run: |
|
||||||
|
if [[ "$(gh pr view ${{ github.event.pull_request.number }} --json commits --jq '.[][0].messageHeadline')" == vim-patch* ]];then
|
||||||
|
npx commitlint --from HEAD~1 --to HEAD --verbose --help-url https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages --config .github/workflows/commitlint.config_patch.js
|
||||||
|
else
|
||||||
|
npx commitlint --from HEAD~1 --to HEAD --verbose --help-url https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages --config .github/workflows/commitlint.config.js
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user