Skip to content

Commit 91841f5

Browse files
authored
ci: add workflow to check Go versions of dependencies (#5340)
1 parent 57ba05c commit 91841f5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check Go versions of dependencies
2+
on:
3+
pull_request:
4+
paths:
5+
- 'go.mod'
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-go-versions:
10+
name: Check Go versions of dependencies
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out code into the Go module directory
14+
uses: actions/[email protected]
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: stable
20+
21+
# This workflow is a workaround before the "old stable" version becomes Go 1.21.
22+
# To avoid updating dependencies that require Go 1.21, we use this workflow
23+
# Example of wrong update:
24+
# https://github.com/aquasecurity/trivy/discussions/5323#discussioncomment-7186321
25+
- name: Check that dependencies doesn't require Go 1.21
26+
run: |
27+
go mod tidy
28+
if grep -q "go 1.21" go.mod; then
29+
echo "One of new dependencies requires Go '1.21'. Use 'go get [email protected]' to fix this."
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)