aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2021-08-02 00:08:31 +0200
committerGitHub <noreply@github.com>2021-08-02 00:08:31 +0200
commit535c762ff7d8303a20047ef5f5b4466c2b78e237 (patch)
tree2627aa1459b2eff97b5fc13065f478db9a6f30af /.github
parent337b1b31ac12ee4351668e32fe116282efd3dcc3 (diff)
parentf54340d488d956cbf641be3d896b5276842d558f (diff)
downloadrneovim-535c762ff7d8303a20047ef5f5b4466c2b78e237.tar.gz
rneovim-535c762ff7d8303a20047ef5f5b4466c2b78e237.tar.bz2
rneovim-535c762ff7d8303a20047ef5f5b4466c2b78e237.zip
Merge pull request #15129 from dundargoc/action/commitlint
ci: add commit linter to GitHub Actions.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/commitlint.config.js35
-rw-r--r--.github/workflows/commitlint.config_patch.js28
-rw-r--r--.github/workflows/commitlint.yml18
3 files changed, 81 insertions, 0 deletions
diff --git a/.github/workflows/commitlint.config.js b/.github/workflows/commitlint.config.js
new file mode 100644
index 0000000000..5f10ffc6f4
--- /dev/null
+++ b/.github/workflows/commitlint.config.js
@@ -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',
+ ],
+ ],
+ },
+};
diff --git a/.github/workflows/commitlint.config_patch.js b/.github/workflows/commitlint.config_patch.js
new file mode 100644
index 0000000000..986d80b2e0
--- /dev/null
+++ b/.github/workflows/commitlint.config_patch.js
@@ -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',
+ ],
+ ],
+ },
+};
diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml
new file mode 100644
index 0000000000..9ae138fbd7
--- /dev/null
+++ b/.github/workflows/commitlint.yml
@@ -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