Skip to content

Commit 1ad1926

Browse files
authored
feat: initial version
feat: initial version
2 parents 2cc7a6f + 5867206 commit 1ad1926

36 files changed

+2485
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [sgaunet]

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: docker
9+
directory: "/"
10+
schedule:
11+
interval: monthly
12+
open-pull-requests-limit: 10
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: monthly
17+
open-pull-requests-limit: 10

.github/workflows/coverage.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Generate coverage badges
2+
on:
3+
push:
4+
branches: [main]
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
generate-badges:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
15+
# setup go environment
16+
- name: Set up Go
17+
uses: actions/setup-go@v6
18+
with:
19+
go-version: 1.25.x
20+
21+
- name: coverage
22+
id: coverage
23+
run: |
24+
go mod download
25+
go generate ./...
26+
go test -coverpkg=./... -coverprofile=profile.cov ./...
27+
sed -i '/cmd/d' profile.cov # remove cmd package from coverage
28+
total=$(go tool cover -func profile.cov | grep '^total:' | awk '{print $3}' | sed "s/%//")
29+
rm profile.cov
30+
echo "COVERAGE_VALUE=${total}" >> $GITHUB_ENV
31+
32+
- uses: actions/checkout@v5
33+
with:
34+
repository: sgaunet/gh-action-badge
35+
path: gh-action-badge
36+
ref: main
37+
fetch-depth: 1
38+
39+
- name: Generate coverage badge
40+
id: coverage-badge
41+
uses: ./gh-action-badge/.github/actions/gh-action-coverage
42+
with:
43+
limit-coverage: "30"
44+
badge-label: "coverage"
45+
badge-filename: "coverage-badge.svg"
46+
badge-value: "${COVERAGE_VALUE}"
47+
48+
- name: Print url of badge
49+
run: |
50+
echo "Badge URL: ${{ steps.coverage-badge.outputs.badge-url }}"

.github/workflows/linter.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: linter
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
linter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: actions/setup-go@v6
15+
with:
16+
go-version: stable
17+
- name: Install task
18+
uses: jaxxstorm/[email protected]
19+
with:
20+
repo: go-task/task
21+
cache: enable
22+
# tag:
23+
- name: Install golangci-lint
24+
uses: jaxxstorm/[email protected]
25+
with:
26+
repo: golangci/golangci-lint
27+
tag: v2.2.2
28+
cache: enable
29+
binaries-location: golangci-lint-2.2.2-linux-amd64
30+
31+
- name: Run linter
32+
shell: /usr/bin/bash {0}
33+
run: |
34+
task lint

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: release
2+
3+
on:
4+
push:
5+
# Pattern matched against refs/tags
6+
tags:
7+
- '**' # Push events to every tag including hierarchical tags like v1.0/beta
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
jobs:
14+
goreleaser-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
-
18+
name: Checkout
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
- name: Install Go
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version: '>=1.25'
26+
- name: Install task
27+
uses: jaxxstorm/[email protected]
28+
with:
29+
repo: go-task/task
30+
# tag:
31+
- name: Install goreleaser
32+
uses: jaxxstorm/[email protected]
33+
with:
34+
repo: goreleaser/goreleaser
35+
# tag:
36+
37+
-
38+
# Add support for more platforms with QEMU (optional)
39+
# https://github.com/docker/setup-qemu-action
40+
name: Set up QEMU
41+
uses: docker/setup-qemu-action@v3
42+
-
43+
name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Login to GitHub Container Registry
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Create release
54+
shell: /usr/bin/bash {0}
55+
run: |
56+
task release
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
60+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
61+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}

.github/workflows/snapshot.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: snapshot
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
goreleaser-snapshot:
11+
runs-on: ubuntu-latest
12+
steps:
13+
-
14+
name: Checkout
15+
uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 0
18+
- name: Install Go
19+
uses: actions/setup-go@v6
20+
with:
21+
go-version: '>=1.25'
22+
- name: Install task
23+
uses: jaxxstorm/[email protected]
24+
with:
25+
repo: go-task/task
26+
cache: true
27+
# tag:
28+
- name: Install goreleaser
29+
uses: jaxxstorm/[email protected]
30+
with:
31+
repo: goreleaser/goreleaser
32+
cache: true
33+
# tag:
34+
35+
-
36+
# Add support for more platforms with QEMU (optional)
37+
# https://github.com/docker/setup-qemu-action
38+
name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
40+
-
41+
name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Login to GitHub Container Registry
45+
uses: docker/login-action@v3
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Create snapshot release
52+
shell: /usr/bin/bash {0}
53+
run: |
54+
task snapshot
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
58+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Vulnerability Scan
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 2 1 * *' # Run at 2 AM on the 1st of every month
10+
workflow_dispatch: # Allow manual triggering
11+
12+
permissions:
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
vulnerability-scan:
18+
runs-on: ubuntu-latest
19+
name: Run govulncheck
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v5
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version-file: 'go.mod'
28+
29+
- name: Run govulncheck
30+
uses: golang/govulncheck-action@v1
31+
with:
32+
go-package: ./...

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Go build output
2+
/gitcommit
3+
/cmd/gitcommit/gitcommit
4+
# Output of the go coverage tool
5+
*.out
6+
coverage.txt
7+
coverage.html
8+
# Build directories
9+
/dist/
10+
/build

.golangci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "2"
2+
# Configure which files to skip during linting
3+
run:
4+
tests: false
5+
6+
linters:
7+
default: all
8+
9+
disable:
10+
- wsl
11+
- wsl_v5
12+
- nlreturn
13+
- depguard
14+
- gochecknoinits
15+
- gochecknoglobals
16+
- forbidigo
17+
- varnamelen
18+
- exhaustruct
19+
- tagliatelle
20+
- noinlineerr
21+
# Intentionally using time.Local for user's local timezone
22+
- gosmopolitan
23+
# strings.SplitSeq doesn't exist in Go 1.21
24+
- modernize

.goreleaser.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2
2+
before:
3+
hooks:
4+
- go mod download
5+
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
main: ./cmd/gitcommit
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- "386"
16+
- amd64
17+
- arm
18+
- arm64
19+
goarm:
20+
- "6"
21+
- "7"
22+
flags:
23+
- -trimpath
24+
ldflags:
25+
- -s -w -X main.version={{.Version}}
26+
id: lin
27+
28+
checksum:
29+
name_template: 'checksums.txt'
30+
31+
changelog:
32+
sort: asc
33+
filters:
34+
exclude:
35+
- '^docs:'
36+
- '^test:'
37+
38+
archives:
39+
- name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
40+
formats: ['binary']
41+
files:
42+
- README.md
43+
- LICENSE
44+
45+
brews:
46+
- homepage: 'https://github.com/sgaunet/gitcommit'
47+
description: ''
48+
directory: Formula
49+
commit_author:
50+
name: sgaunet
51+
52+
repository:
53+
owner: sgaunet
54+
name: homebrew-tools
55+
# Token with 'repo' scope is required for pushing to a different repository
56+
token: '{{ .Env.HOMEBREW_TAP_TOKEN }}'
57+
url_template: 'https://github.com/sgaunet/gitcommit/releases/download/{{ .Tag }}/{{ .ArtifactName }}'
58+
install: |
59+
bin.install "{{ .ArtifactName }}" => "gitcommit"
60+
test: |
61+
system "#{bin}/gitcommit", "--help"

0 commit comments

Comments
 (0)