danger-plugin-conventional-commitlint-gitlab-mr v3.1.2
danger-plugin-conventional-commitlint-gitlab-mr
This plugin checks a MR properties & It ensures that the MR title and the commmit messages follow the conventional commit lint rules..
Here are the conditions :
If MR sqash flag is true & multiple commits - title must be correct
If MR sqash flag is false & multiple commits - at least one commit must be correct
if single commit - first commit line must be correct
Usage
This plugin has been created especially for GITLAB and is supposed to be integrated in a CI job. It will not work for GitHub__
Install (with yarn or npm):
npm install --save-dev danger-plugin-conventional-commitlint-gitlab-mr
At a glance:
If you dangerfile is located in a module-like folder, it will look like this :
// dangerfile.js
import check from 'danger-plugin-conventional-commitlint-gitlab-mr'
import configConventional from '@commitlint/config-conventional';
(async function dangerReport() {
const commitlintConfig = {
severity: 'warn'
};
await check(configConventional.rules, commitlintConfig);
})();
If you get an isssue related to the import statement, try this:
In your project root folder :
- Create a sub folder
- Create a dangerfile.js inside of it
const commitlint = require('danger-plugin-conventional-commitlint-gitlab-mr')
const configConventional = require('@commitlint/config-conventional')
;(async function dangerReport() {
const commitlintConfig = {
severity: 'fail',
}
await commitlint.default(configConventional.rules, commitlintConfig)
})()
-- You will need to install a few dependencies for the plugin to work :
run npm init
npm i commitlint/lint@8.3.5
npm i commitlint/config-conventional@13.1.0
- install the plugin :
npm install --save-dev danger-plugin-conventional-commitlint-gitlab-mr
Changelog
See the GitHub release history.
Contributing
See CONTRIBUTING.md.