From 8b587a1d4ebcfb4343b5e629e8b4282d08f52d3d Mon Sep 17 00:00:00 2001 From: Nathan Levett <17214791+Skenvy@users.noreply.github.com> Date: Tue, 3 Oct 2023 04:33:23 +1100 Subject: [PATCH] .github/workflows: dynamic Go versions in vuln workflow (#2800) Swap from hard coded versions of go to dynamically acquiring the latest stable versions from https://go.dev/dl/?mode=json Closes #2573 --- .github/workflows/vuln.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/vuln.yml b/.github/workflows/vuln.yml index 19b302e49..f3bc863e6 100644 --- a/.github/workflows/vuln.yml +++ b/.github/workflows/vuln.yml @@ -3,11 +3,27 @@ name: Vulnerability Check on: [push, pull_request] jobs: + go-versions: + name: Get stable Go versions + runs-on: ubuntu-latest + outputs: + version-list: ${{ steps.go-dev-stable-versions.outputs.version-list }} + steps: + - name: List the latest stable versions of Go + id: go-dev-stable-versions + run: | + versions_json=$(curl -s https://go.dev/dl/?mode=json | jq '.[].version' | sed -e 's/^"go/"/' | jq -s -c '.') + echo "version-list=$versions_json" >> $GITHUB_OUTPUT + + - name: Notify on go-dev-stable-versions + run: echo "::notice::version-list is ${{ steps.go-dev-stable-versions.outputs.version-list }}" + test: + needs: [go-versions] strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - go: ['1.20.7', '1.21.0'] + go: ${{ fromJson(needs.go-versions.outputs.version-list) }} name: Vulnerability Check with Go ${{ matrix.go }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} env: