Skip to content

Commit 98ae97c

Browse files
committed
Fix git validation check in GitHub actions
Signed-off-by: Austin Vazquez <[email protected]>
1 parent 067d5c7 commit 98ae97c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/go.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ jobs:
2222
go-version: ${{ matrix.go }}
2323

2424
- name: Check out code into the Go module directory
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
26+
with:
27+
# By default, the checkout action only fetches the last commit,
28+
# but we want to run DCO check against all commit messages.
29+
# Assuming that a pull request may have multiple commits,
30+
# fetching the single commit doesn't work for us.
31+
#
32+
# While DCO check (on Makefile) checks latest 5 commits,
33+
# the checkout action automatically creates a merge commit
34+
# for merging "main" into a pull request branch.
35+
# In addition to that, Git cannot recognize merge commits when
36+
# one of the parents is missing.
37+
# So, we will fetch 15 commits just in case to have
38+
# 5 actual commits with associated merged commits.
39+
fetch-depth: 15
2640

2741
- name: Run static analysis
2842
run: make lint

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ $(BINPATH)/golangci-lint:
5858

5959
lint: $(BINPATH)/ltag $(BINPATH)/git-validation $(BINPATH)/golangci-lint
6060
$(BINPATH)/ltag -v -t ./.headers -check
61-
$(BINPATH)/git-validation -q -run DCO,short-subject -range HEAD~3..HEAD
61+
$(BINPATH)/git-validation -q -run DCO,short-subject -range HEAD~5..HEAD
6262
$(BINPATH)/golangci-lint run
6363

6464
clean:

0 commit comments

Comments
 (0)