danger-plugin-commitlint-gitlab

This plugin checks a merge request title and commit messages to make sure they are well formatted and respect the commitlint/lint

Usage no npm install needed!

<script type="module">
  import dangerPluginCommitlintGitlab from 'https://cdn.skypack.dev/danger-plugin-commitlint-gitlab';
</script>

README

danger-plugin-commitlint-gitlab

Build Status npm version semantic-release

This plugin checks a merge request title and commit messages to make sure they are well formatted and respect the commitlint/lint

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

Rules

Usage

This plugin has been created especially for GITLAB and is supposed to be integrated in a CI job. It will not work in GitHub__

Install (with yarn or npm):

npm install --save-dev  danger-plugin-commitlint-gitlab 

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
npm install --save-dev  danger-plugin-commitlint-gitlab 

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.