commitlint-gitlab-ci

0.0.4 • Public • Published

commitlint-gitlab-ci

Beyond a doubt, commitlint is a useful tool for working with verifying a Git history and keeping everything clean, more so when working with semantic-release.

When working with Gitlab, commitlint has a minor issue when run for the first time or when force push is used. The fix is the following:

if [ "${CI_BUILD_BEFORE_SHA}" = "0000000000000000000000000000000000000000" ]; then
  echo "commitlint from HEAD^"
  npx commitlint -x @commitlint/config-conventional -f HEAD^
else
  echo "commitlint from ${CI_BUILD_BEFORE_SHA}"
  br=`git branch -r --contains ${CI_BUILD_BEFORE_SHA}`
  if [ ! -n $br ]; then
    npx commitlint -x @commitlint/config-conventional -f HEAD^
  else
    npx commitlint -x @commitlint/config-conventional -f "${CI_BUILD_BEFORE_SHA}"
  fi
fi

To make it easier to do the above, this package was created to consolidate it down to a single line:

npx commitlint-gitlab-ci -x @commitlint/config-conventional

Any parameter can be used, this just wraps it around the call the various if statements needed to work with Gitlab.

Readme

Keywords

none

Package Sidebar

Install

npm i commitlint-gitlab-ci

Weekly Downloads

1,157

Version

0.0.4

License

MIT

Unpacked Size

4.39 kB

Total Files

4

Last publish

Collaborators

  • dmoonfire