File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 15
15
- uses : actions/checkout@v4
16
16
with :
17
17
submodules : false
18
+ fetch-depth : 0
18
19
19
20
# Cache build tools to avoid downloading them each time
20
21
- uses : actions/cache@v4
28
29
go-version : 1.24
29
30
cache : false
30
31
32
+ - name : Fetch base branch
33
+ run : |
34
+ if [ ! -z "$GITHUB_BASE_REF" ]; then
35
+ git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
36
+ fi
37
+
31
38
- name : Run linters
32
39
run : |
33
40
go run build/ci.go lint
56
63
57
64
- name : Run tests
58
65
run : go test ./...
66
+
Original file line number Diff line number Diff line change @@ -433,7 +433,14 @@ func doLint(cmdline []string) {
433
433
}
434
434
435
435
linter := downloadLinter (* cachedir )
436
- lflags := []string {"run" , "--config" , ".golangci.yml" , "--new-from-rev=origin/master" }
436
+ baseRef := "master"
437
+ if ref := os .Getenv ("GITHUB_BASE_REF" ); ref != "" {
438
+ baseRef = ref
439
+ }
440
+
441
+ lflags := []string {"run" , "--config" , ".golangci.yml" ,
442
+ fmt .Sprintf ("--new-from-rev=origin/%s" , baseRef ),
443
+ }
437
444
build .MustRunCommandWithOutput (linter , append (lflags , packages ... )... )
438
445
fmt .Println ("You have achieved perfection." )
439
446
}
@@ -1172,3 +1179,4 @@ func doSanityCheck() {
1172
1179
csdb := download .MustLoadChecksums ("build/checksums.txt" )
1173
1180
csdb .DownloadAndVerifyAll ()
1174
1181
}
1182
+
You can’t perform that action at this time.
0 commit comments