Skip to content

Commit 0e0ab57

Browse files
bestbeforetodaydenyeart
authored andcommitted
Run vulnerability scan on latest release version
Previously the scan ran on the current state of the codebase. This fails to identify vulnerabilities in dependencies for the latest release version if those dependencies have already been updated in the development codebase. The gating factor for whether a new release is required should be whether the previous release contains vulnerabilities. This change runs the scheduled vulnerability scan on the latest release tag. It also adds vulnerability scanning to pull request builds. This is purely informational. A scan failure does not fail the pull request build. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 55e983e commit 0e0ab57

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

.github/workflows/pull_request.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
build:
1717
uses: ./.github/workflows/test.yml
1818

19+
scan:
20+
uses: ./.github/workflows/scan.yml
21+
1922
pull-request:
2023
needs: build
2124
name: Pull request success

.github/workflows/scan.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Security vulnerability scan"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: Branch, tag or SHA to scan.
8+
type: string
9+
required: false
10+
default: ""
11+
12+
jobs:
13+
scan:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
ref: ${{ inputs.ref }}
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: stable
23+
check-latest: true
24+
- name: Scan
25+
run: make scan

.github/workflows/vulnerability-scan.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
scan:
9+
latest-release-version:
10+
name: Get latest release tag
1011
runs-on: ubuntu-latest
12+
outputs:
13+
tag_name: ${{ steps.tag-name.outputs.value }}
1114
steps:
12-
- uses: actions/checkout@v4
13-
- name: Set up Go
14-
uses: actions/setup-go@v5
15-
with:
16-
go-version: stable
17-
check-latest: true
18-
- name: Scan
19-
run: make scan
15+
- id: tag-name
16+
run: echo "value=$(curl --location --silent --fail "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq --raw-output '.tag_name')" >> "${GITHUB_OUTPUT}"
17+
18+
scan:
19+
name: Scan ${{ needs.latest-release-version.outputs.tag_name }}
20+
needs: latest-release-version
21+
uses: ./.github/workflows/scan.yml
22+
with:
23+
ref: ${{ needs.latest-release-version.outputs.tag_name }}

0 commit comments

Comments
 (0)