|
| 1 | +<p align="center"> |
| 2 | + <img src="https://github.com/coolapso/convcommitlint/blob/main/images/logo.png" width="200" > |
| 3 | +</p> |
| 4 | + |
| 5 | +# CONVCOMMITLINT |
| 6 | +[](https://github.com/coolapso/convcommitlint/actions/workflows/release.yaml) |
| 7 | + |
| 8 | +[](https://hub.docker.com/r/coolapso/convcommitlint) |
| 9 | +[](https://goreportcard.com/report/github.com/coolapso/convcommitlint) |
| 10 | + |
| 11 | + |
| 12 | +A simple, slightly opinionated, yet usable linter for [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), written in Go. |
| 13 | +This linter covers the convention essentials, contributions are wellcome but, no! I don't intend to support all kinds of variations and custom rules! |
| 14 | + |
| 15 | +## Motivation |
| 16 | + |
| 17 | +I just wanted something simple that works, not configure all kinds of things just to get a linter working! |
| 18 | + |
| 19 | +## Features |
| 20 | + |
| 21 | +* Checks for header syntax |
| 22 | +* Checks for common typos on the most important keywords: fix, feat and BREAKING CHANGE |
| 23 | +* Supports creating pull github pull request reviews |
| 24 | + * Supports request for changes (default) |
| 25 | + * Supports commenting only |
| 26 | +* Supports linting only the current commit |
| 27 | +* Supports linting all commits |
| 28 | +* Supports linting only most recent commits from base branch |
| 29 | + |
| 30 | +## How it works |
| 31 | + |
| 32 | +convcommitlint will check your commits against the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, and let you know if there are any issues, when running on github actions and if you enable creation of pull request reviews it will create a pull request review for you. |
| 33 | + |
| 34 | +## Installation |
| 35 | + |
| 36 | +### Github action |
| 37 | + |
| 38 | +Github action is available to use with your CI pipelines and most arguments from the CLI application are available. |
| 39 | + |
| 40 | +``` |
| 41 | + convcommitlint: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: coolapso/convcommitlint@v0 |
| 45 | +``` |
| 46 | + |
| 47 | +You can find the available inputs in the [action.yaml](action.yaml) file, if a input is not available you still should be able to use it by setting the associated ENV variable. |
| 48 | + |
| 49 | +### Docker |
| 50 | + |
| 51 | +You can run convcommitlint with docker, containers are provided both on dockerhub and ghcr.io |
| 52 | + |
| 53 | +**ghcr.io** |
| 54 | + |
| 55 | +``` |
| 56 | +docker run -v $(pwd):/data --rm ghcr.io/coolapso/convcommitlint:latest |
| 57 | +``` |
| 58 | + |
| 59 | +**dockerhub:** |
| 60 | + |
| 61 | +``` |
| 62 | +docker run -v $(pwd):/data --rm coolapso/convcommitlint:latest |
| 63 | +``` |
| 64 | + |
| 65 | +### Go Install |
| 66 | + |
| 67 | +#### Latest version |
| 68 | + |
| 69 | +`go install github.com/coolapso/convcommitlint@latest` |
| 70 | + |
| 71 | +#### Specific version |
| 72 | + |
| 73 | +`go install github.com/coolapso/convcommitlint@v1.0.0` |
| 74 | + |
| 75 | +### AUR |
| 76 | + |
| 77 | +On Arch linux you can use the AUR `convcommitlint-bin` |
| 78 | + |
| 79 | +### Linux Script |
| 80 | + |
| 81 | +It is also possible to install on any linux distro with the installation script |
| 82 | + |
| 83 | +#### Latest version |
| 84 | + |
| 85 | +``` |
| 86 | +curl -L http://commitlint.coolapso.sh/install.sh | bash |
| 87 | +``` |
| 88 | + |
| 89 | +#### Specific version |
| 90 | + |
| 91 | +``` |
| 92 | +curl -L http://commitlint.coolapso.sh/install.sh | VERSION="v1.1.0" bash |
| 93 | +``` |
| 94 | + |
| 95 | +### Manual install |
| 96 | + |
| 97 | +* Grab the binary from the [releases page](https://github.com/coolapso/convcommitlint/releases). |
| 98 | +* Extract the binary |
| 99 | +* Execute it |
| 100 | + |
| 101 | + |
| 102 | +## Usage |
| 103 | + |
| 104 | +``` |
| 105 | +Usage: |
| 106 | + convcommitlint [flags] |
| 107 | + convcommitlint [command] |
| 108 | +
|
| 109 | +Available Commands: |
| 110 | + completion Generate the autocompletion script for the specified shell |
| 111 | + help Help about any command |
| 112 | + version Print convcommitlint version |
| 113 | +
|
| 114 | +Flags: |
| 115 | + -b, --base-branch string The base branch to check commits from (default "main") |
| 116 | + --comment-only Pull request reviews will only comment instead of requesting changes |
| 117 | + -r, --create-review Creates review on github pull request |
| 118 | + -c, --current Lint only the current commit |
| 119 | + -h, --help help for convcommitlint |
| 120 | + -a, --lint-all Lint all repository commits |
| 121 | + -p, --path string Git repository path (default "./") |
| 122 | + --pr-number int The number of pull request to create the review |
| 123 | + --repository string The github repository in owner/name format ex: coolapso/convcommitlint |
| 124 | +
|
| 125 | +Use "convcommitlint [command] --help" for more information about a command. |
| 126 | +``` |
| 127 | + |
| 128 | +## Build |
| 129 | + |
| 130 | +`go build -o convcommitlint |
| 131 | + |
| 132 | +# Contributions |
| 133 | + |
| 134 | +Improvements and suggestions are always welcome, feel free to check for any open issues, open a new Issue or Pull Request |
| 135 | + |
| 136 | +If you like this project and want to support / contribute in a different way you can always [:heart: Sponsor Me](https://github.com/sponsors/coolapso) or |
| 137 | + |
| 138 | +<a href="https://www.buymeacoffee.com/coolapso" target="_blank"> |
| 139 | + <img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" /> |
| 140 | +</a> |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | +Also consider supporting [tapio/live-server](https://github.com/tapio/live-server) which inspired this project |
| 145 | + |
0 commit comments