Skip to content

Commit 11f20c8

Browse files
committed
use path anker in workflow yaml
1 parent 1ae3354 commit 11f20c8

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

.github/workflows/go.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,50 @@ name: CI
22
on:
33
push:
44
branches: ["main", "devel"]
5-
paths:
5+
paths: &paths
66
- 'go.mod'
77
- '**.go'
88
- '**.yml'
99
- '**.yaml'
1010
pull_request:
1111
branches: ["main", "devel"]
12-
paths:
13-
- 'go.mod'
14-
- '**.go'
15-
- '**.yml'
16-
- '**.yaml'
12+
paths: *paths
1713

14+
# Best Practice: Restrict global permissions to minimum required (Read-Only)
1815
permissions:
1916
contents: read
2017

2118
jobs:
2219
test:
23-
strategy:
24-
fail-fast: true
2520
runs-on: ubuntu-latest
2621
steps:
2722
- uses: actions/checkout@v5
28-
- uses: actions/setup-go@v6
2923
with:
24+
# Disable credential persisting for enhanced security
3025
persist-credentials: false
26+
27+
- uses: actions/setup-go@v6
28+
with:
3129
go-version-file: go.mod
32-
cache: true
33-
- run: go test -v ./...
30+
cache: true # Enable build caching for faster test execution
31+
32+
- name: Run Tests
33+
run: go test -v ./...
3434

3535
linting:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v5
39-
- uses: actions/setup-go@v6
4039
with:
4140
persist-credentials: false
41+
42+
- uses: actions/setup-go@v6
43+
with:
4244
go-version-file: go.mod
43-
cache: true
45+
cache: false # golangci-lint-action handles its own caching
4446

4547
- name: golangci-lint
4648
uses: golangci/golangci-lint-action@v9
4749
with:
48-
version: v2.12.0
50+
# Use 'latest' to prevent version mismatch with go.mod
51+
version: latest

0 commit comments

Comments
 (0)