Skip to content

Commit ed4231a

Browse files
committed
feat: Hello world!
0 parents  commit ed4231a

23 files changed

Lines changed: 1903 additions & 0 deletions

.github/workflows/docker.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Docker
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release_tag:
6+
required: true
7+
description: The release tag to build
8+
workflow_call:
9+
inputs:
10+
release_tag:
11+
type: string
12+
required: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-tags: true
21+
fetch-depth: 0
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Login to Docker Hub
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ vars.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
35+
- name: Login to github container registry
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Set docker_tag
43+
run: |
44+
echo "got input: '${{ inputs.release_tag }}'"
45+
echo "DOCKER_TAG=$(echo '${{ inputs.release_tag }}' | sed -E 's/^v//g')" >> $GITHUB_ENV
46+
echo "Going to build: $DOCKER_TAG || '${{ env.DOCKER_TAG }}'"
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
50+
with:
51+
platforms: linux/amd64,linux/arm64,linux/arm/v7
52+
push: true
53+
tags: coolapso/convcommitlint:latest,coolapso/convcommitlint:${{ env.DOCKER_TAG }},ghcr.io/coolapso/convcommitlint:latest,ghcr.io/coolapso/convcommitlint:${{ env.DOCKER_TAG }}
54+
build-args: VERSION=${{ inputs.release_tag }}
55+

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
tests:
10+
uses: coolapso/convcommitlint/.github/workflows/test.yaml@main
11+
12+
release:
13+
needs: tests
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
outputs:
18+
version: ${{ steps.semrel.outputs.version }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-go@v5
22+
with:
23+
go-version: '>=1.23'
24+
- uses: go-semantic-release/action@v1
25+
id: semrel
26+
with:
27+
custom-arguments: '--commit-analyzer-opt patch_release_rules=fix,ref,build'
28+
hooks: goreleaser
29+
allow-initial-development-versions: true
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
AUR_KEY: ${{ secrets.AUR_KEY }}
33+
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
34+
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
35+
36+
- name: Update Docker Hub Description
37+
uses: peter-evans/dockerhub-description@v4
38+
with:
39+
username: ${{ vars.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
repository: coolapso/convcommitlint
42+
43+
docker:
44+
needs: release
45+
uses: coolapso/convcommitlint/.github/workflows/docker.yaml@main
46+
if: ${{ needs.release.outputs.version != '' }}
47+
secrets: inherit
48+
with:
49+
release_tag: ${{ needs.release.outputs.version }}
50+

.github/workflows/test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Go
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
pull_request:
7+
push:
8+
branches:
9+
- '**'
10+
- '!main'
11+
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '>=1.23'
24+
25+
- name: Install dependencies
26+
run: go get .
27+
28+
- name: Check formating
29+
run: |
30+
changedFiles=$(go fmt ./...)
31+
if [[ -n $changedFiles ]]; then
32+
echo -e "Follwing files are not formated:\n${changedFiles}"
33+
exit 1
34+
fi
35+
36+
- name: golangci-lint
37+
uses: golangci/golangci-lint-action@v6
38+
with:
39+
version: latest
40+
only-new-issues: true
41+
42+
- name: Run tests
43+
run: go test -cover ./...
44+
45+
- name: test build
46+
run: go build -o convcommitlint
47+
48+
convcommitlint:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: coolapso/convcommitlint@main
52+
continue-on-error: true
53+

.goreleaser.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .goreleaser.yaml
2+
builds:
3+
- binary: convcommitlint
4+
env:
5+
- CGO_ENABLED=0
6+
ldflags:
7+
- -X github.com/coolapso/convcommitlint/cmd.Version={{.Version}}
8+
9+
aurs:
10+
- name: convcommitlint-bin
11+
homepage: "https://github.com/coolapso/convcommitlint"
12+
description: "A simple, opinionated, yet usable linter for conventional commits, written in Go."
13+
maintainers:
14+
- "coolapso <coolapso@coolapso.tech>"
15+
16+
license: "MIT"
17+
private_key: "{{ .Env.AUR_KEY }}"
18+
git_url: "ssh://aur@aur.archlinux.org/convcommitlint-bin.git"
19+
skip_upload: auto
20+
21+
# Git author used to commit to the repository.
22+
commit_author:
23+
name: goreleaserbot
24+
email: bot@goreleaser.com
25+
26+
announce:
27+
discord:
28+
enabled: true

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM --platform=$BUILDPLATFORM golang:latest AS builder
2+
ARG TARGETARCH
3+
ARG VERSION
4+
5+
6+
WORKDIR /convcommitlint
7+
COPY . .
8+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -ldflags="-X github.com/coolapso/convcommitlint/cmd.Version=${VERSION}" -a -o convcommitlint
9+
10+
FROM alpine:latest
11+
12+
COPY --from=builder convcommitlint/convcommitlint /usr/bin/convcommitlint
13+
RUN mkdir /data
14+
15+
WORKDIR data
16+
ENTRYPOINT ["/usr/bin/convcommitlint"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Carlos Colaço
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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+
[![Release](https://github.com/coolapso/convcommitlint/actions/workflows/release.yaml/badge.svg?branch=main)](https://github.com/coolapso/convcommitlint/actions/workflows/release.yaml)
7+
![GitHub Tag](https://img.shields.io/github/v/tag/coolapso/convcommitlint?logo=semver&label=semver&labelColor=gray&color=green)
8+
[![Docker image version](https://img.shields.io/docker/v/coolapso/convcommitlint/latest?logo=docker)](https://hub.docker.com/r/coolapso/convcommitlint)
9+
[![Go Report Card](https://goreportcard.com/badge/github.com/coolapso/convcommitlint)](https://goreportcard.com/report/github.com/coolapso/convcommitlint)
10+
![GitHub Sponsors](https://img.shields.io/github/sponsors/coolapso?style=flat&logo=githubsponsors)
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

Comments
 (0)