-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow to check Go versions of dependencies (#5340)
- Loading branch information
1 parent
57ba05c
commit 91841f5
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check Go versions of dependencies | ||
on: | ||
pull_request: | ||
paths: | ||
- 'go.mod' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-go-versions: | ||
name: Check Go versions of dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
|
||
# This workflow is a workaround before the "old stable" version becomes Go 1.21. | ||
# To avoid updating dependencies that require Go 1.21, we use this workflow | ||
# Example of wrong update: | ||
# https://github.com/aquasecurity/trivy/discussions/5323#discussioncomment-7186321 | ||
- name: Check that dependencies doesn't require Go 1.21 | ||
run: | | ||
go mod tidy | ||
if grep -q "go 1.21" go.mod; then | ||
echo "One of new dependencies requires Go '1.21'. Use 'go get [email protected]' to fix this." | ||
exit 1 | ||
fi |