mirror of
https://github.com/tiennm99/ghstats.git
synced 2026-09-02 16:20:08 +00:00
chore: small hygiene fixes from code review
- I3 — update FetchOptions doc to describe zero-value vs CLI-flag defaults. - I5 — release workflow gates docker/binaries on a test job; tags no longer ship broken artifacts. - N1 — replace handwritten joinErrs with strings.Join. - N3 — truncate() now backs up to a UTF-8 rune boundary so error messages never end on a split codepoint. - N4 — pin Docker base images (golang:1.26-alpine, alpine:3.21) to SHA256 digests. - N5 — pin third-party GitHub Actions to commit SHAs with version comments for readability. - N9 — drop the "(non-fork)" qualifier from the stats card label; the underlying GraphQL doesn't actually filter forks, so the phrasing was misleading.
This commit is contained in:
@@ -9,8 +9,8 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
|
||||
with:
|
||||
go-version: "1.26"
|
||||
cache: true
|
||||
|
||||
@@ -10,19 +10,31 @@ permissions:
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
|
||||
with:
|
||||
go-version: "1.26"
|
||||
cache: true
|
||||
- run: go vet ./...
|
||||
- run: go test ./...
|
||||
|
||||
docker:
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Resolve tag metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
@@ -30,7 +42,7 @@ jobs:
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=raw,value=latest
|
||||
- uses: docker/build-push-action@v6
|
||||
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
@@ -38,6 +50,7 @@ jobs:
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
binaries:
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -55,8 +68,8 @@ jobs:
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
|
||||
with:
|
||||
go-version: "1.26"
|
||||
cache: true
|
||||
@@ -76,6 +89,6 @@ jobs:
|
||||
else
|
||||
tar -czf "ghstats_${GOOS}_${GOARCH}.tar.gz" "$bin"
|
||||
fi
|
||||
- uses: softprops/action-gh-release@v2
|
||||
- uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
|
||||
with:
|
||||
files: dist/ghstats_*.*
|
||||
|
||||
Reference in New Issue
Block a user