mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 00:06:54 +00:00
On v4, we used the default nodejs resolution logic to allow ES modules in dependencies. This created a breaking change of forcing users of this action to use the .cjs extension instead of .js in config files. With this fix, we now bundle the action with rollup to allow ES modules in dependencies, while keeping the support for .js config files. With this change, the default config file was returned back to .js instead of .cjs. Fixes #194
28 lines
778 B
JavaScript
28 lines
778 B
JavaScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
const { maxLineLength } = require('@commitlint/ensure')
|
|
|
|
const bodyMaxLineLength = 100
|
|
|
|
const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
|
|
const { type, scope, body } = parsedCommit
|
|
const isDepsCommit =
|
|
type === 'chore' && (scope === 'deps' || scope === 'deps-dev')
|
|
|
|
return [
|
|
isDepsCommit || !body || maxLineLength(body, bodyMaxLineLength),
|
|
`body's lines must not be longer than ${bodyMaxLineLength}`,
|
|
]
|
|
}
|
|
|
|
module.exports = {
|
|
extends: ['@commitlint/config-conventional'],
|
|
plugins: ['commitlint-plugin-function-rules'],
|
|
rules: {
|
|
'body-max-line-length': [0],
|
|
'function-rules/body-max-line-length': [
|
|
2,
|
|
'always',
|
|
validateBodyMaxLengthIgnoringDeps,
|
|
],
|
|
},
|
|
}
|