Lint all relevant commits for a change or PR on Circle CI
This package is a convenience wrapper around commitlint
,
providing zero-configuration linting of all relevant commits
for a given change/build combination.
yarn add @timbeyer/commitlint-circle --dev
# .circleci/config.yml
- run: yarn commitlint-circle
commitlint-circle
for historical reasons assumes that your repository uses master
as its main branch name. Github and Gitlab have since moved on from this name and started using main
as the default name. In order to preserve backward compatibility, you can pass CIRCLE_REPOSITORY_MAIN_BRANCH
:
# .circleci/config.yml
my-task:
environment:
CIRCLE_REPOSITORY_MAIN_BRANCH: origin/main
steps:
- # [...]
- run: yarn commitlint-circle
Note that you can pass both main
, origin/main
or any other branch name that is your default. commitlint-circle
will prefix it with the remote origin
if it isn't there.