From 3246bf5f4e24025b4a14ed99eeb4a8f954626519 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:13:59 +0200 Subject: ci(lintcommit.lua): replace third-party commitlint #15747 --- .github/workflows/commitlint.config.js | 35 ---------------------------- .github/workflows/commitlint.config_patch.js | 27 --------------------- .github/workflows/commitlint.yml | 12 ++++------ scripts/lintcommit.lua | 2 +- 4 files changed, 6 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/commitlint.config.js delete mode 100644 .github/workflows/commitlint.config_patch.js diff --git a/.github/workflows/commitlint.config.js b/.github/workflows/commitlint.config.js deleted file mode 100644 index 5f10ffc6f4..0000000000 --- a/.github/workflows/commitlint.config.js +++ /dev/null @@ -1,35 +0,0 @@ -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 deleted file mode 100644 index ca398c45dc..0000000000 --- a/.github/workflows/commitlint.config_patch.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - parserPreset: { - parserOpts: { headerPattern: /^([^\(\):]*)(?:\((.*)\))?!?:(.*)$/ } - }, - rules: { - 'body-leading-blank': [1, 'always'], - 'body-max-line-length': [2, 'always', 100], - '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 index 9ae138fbd7..4c9c526946 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -9,10 +9,8 @@ jobs: - 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 + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + - run: gh pr checkout ${{ github.event.pull_request.number }} + - run: nvim --clean -es +"lua require('scripts.lintcommit').main({trace=true})" diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index 11ad8eb9ef..98f9da246c 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -91,7 +91,7 @@ local function validate_commit(commit_message) -- Check that description doesn't end with a period if vim.endswith(after_colon, ".") then - return [[Description ends with a period (\".\").]] + return [[Description ends with a period (".").]] end -- Check that description has exactly one whitespace after colon, followed by -- cgit