Skip to content

Commit

Permalink
ci: add workflow to check Go versions of dependencies (#5340)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen authored Oct 9, 2023
1 parent 57ba05c commit 91841f5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check-go-versions.yaml
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

0 comments on commit 91841f5

Please sign in to comment.