Skip to content

Commit

Permalink
doc: add usage and config to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaffen committed Nov 8, 2024
1 parent 1d35684 commit d86c005
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
# Vox Pupuli Commitlint Container

[![CI](https://github.com/voxpupuli/container-commitlint/actions/workflows/ci.yaml/badge.svg)](https://github.com/voxpupuli/container-commitlint/actions/workflows/ci.yaml)
[![License](https://img.shields.io/github/license/voxpupuli/container-commitlint.svg)](https://github.com/voxpupuli/container-commitlint/blob/main/LICENSE)
[![Sponsored by betadots GmbH](https://img.shields.io/badge/Sponsored%20by-betadots%20GmbH-blue.svg)](https://www.betadots.de)

This container can be used to lint commits.
It encapsulates [commitlint](https://github.com/conventional-changelog/commitlint) and all necessary plugins.
See [package.json](package.json) for details. This is a npm application running in an alpine container.

## Usage

### Lint last commit only

```shell
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
```

### Lint all commits from a branch

```shell
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
```

### More options

For more options see:

```shell
podman run -it --rm -v $PWD:/data ghcr.io/voxpupuli/commitlint:latest --help
```

### Example commitlint config

See [.commitlint.yaml](.commitlintrc.yaml)

```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]
```

0 comments on commit d86c005

Please sign in to comment.