This container can be used to lint commits. It encapsulates commitlint and all necessary plugins. See package.json for details. This is a npm application running in an alpine container.
podman run -it --rm -v $PWD:/data ghcr.io/voxpupuli/commitlint:latest
# or (but thats the default)
podman run -it --rm -v $PWD:/data ghcr.io/voxpupuli/commitlint:latest --last
podman run -it --rm -v $PWD:/data ghcr.io/voxpupuli/commitlint:latest \
--from $(git merge-base $(git symbolic-ref refs/remotes/origin/HEAD --short) HEAD) \
--to HEAD
For more options see:
podman run -it --rm -v $PWD:/data ghcr.io/voxpupuli/commitlint:latest --help
See .commitlint.yaml
---
# The rules below have been manually copied from @commitlint/config-conventional
# and match the v1.0.0 specification:
# https://www.conventionalcommits.org/en/v1.0.0/#specification
#
# You can remove them and uncomment the config below when the following issue is
# fixed: https://github.com/conventional-changelog/commitlint/issues/613
#
# extends:
# - '@commitlint/config-conventional'
rules:
body-leading-blank: [1, always]
body-max-line-length: [2, always, 100]
footer-leading-blank: [1, always]
footer-max-line-length: [2, always, 100]
header-max-length: [2, always, 100]
subject-case:
- 2
- never
- [sentence-case, start-case, pascal-case, upper-case]
subject-empty: [2, never]
subject-full-stop: [2, never, "."]
type-case: [2, always, lower-case]
type-empty: [2, never]
type-enum:
- 2
- always
- [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]
commitlint:
stage: .pre # Default Stage of gitlab-ci. Runs before every other pipeline
image:
name: ghcr.io/voxpupuli/commitlint:latest
entrypoint: [""] # overwrite entrypoint
interruptible: true
variables:
# Checkout entire repo and use clone
GIT_DEPTH: 0
GIT_STRATEGY: clone
script:
# switch to MR branch instead of detached HEAD
- git switch $CI_COMMIT_REF_NAME
- commitlint --from $(git merge-base origin/$CI_DEFAULT_BRANCH HEAD) --to HEAD
rules:
# only run on merge request pipelines
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'