Skip to content
Open
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ jobs:
with:
version: v2.4.0

vulnerability-scan:
name: Vulnerability Scan
uses: ./.github/workflows/vulncheck.yml
permissions:
security-events: write
with:
target-branch: ${{ github.event.pull_request.base.ref || github.ref_name }}
go-version-input: '1.24.10'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get the golang version from the go.mod file like how we do it for the setup-go action on line 72?


unit-test:
name: Unit Tests
runs-on: ubuntu-22.04
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/nightly-scans.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: nightly-scans.yml
on:
schedule:
- cron: '0 2 * * *' # Runs daily at 2:00 AM UTC
workflow_dispatch:

jobs:
scan-main:
name: Vulnerability Scan - Main
uses: ./.github/workflows/vulncheck.yml
with:
target-branch: 'main'

scan-v2:
name: Vulnerability Scan - dev-v2
uses: ./.github/workflows/vulncheck.yml
with:
target-branch: 'dev-v2'
52 changes: 52 additions & 0 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: vulncheck.yaml
on:
workflow_call:
inputs:
go-version-input:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the go-version-input inputs be removed now?

description: 'Go version to install'
type: string
required: false
default: '1.24.10'
target-branch:
description: 'Target branch to run govulncheck against'
type: string
required: false
default: 'main'
workflow_dispatch:
inputs:
go-version-input:
description: 'Go version to install'
required: false
default: '1.24.10'
target-branch:
description: 'Target branch to run govulncheck against'
required: false
default: 'main'

jobs:
vulncheck:
name: Vulnerability Check
runs-on: ubuntu-22.04
permissions:
security-events: write # for reporting vulnerabilities via code-scanning API
steps:
- name: Checkout Repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
fetch-depth: 0
ref: ${{ inputs.targetBranch || 'main' }}

- name: Check Go version
id: get-go-version
run: |
echo "Reading from go.mod"
GO_VERSION=$(grep -E "^toolchain " go.mod | awk -F' ' '{print $2}' | tr -d 'go')
echo "Found $GO_VERSION"
echo "go-version="$GO_VERSION"" >> $GITHUB_OUTPUT
- name: Run govulncheck
id: govulncheck
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
with:
go-version-input: ${{ steps.get-go-version.outputs.go-version }}
Loading