Skip to content

Commit ae4e16b

Browse files
committed
fix VulnScan target branch
1 parent dc3d6b9 commit ae4e16b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ jobs:
105105
contents: read
106106
security-events: write # for reporting vulnerabilities via code-scanning API
107107
with:
108-
target-branch: ${{ github.event.pull_request.base.ref || github.ref_name }}
108+
# Use PR head branch (the feature branch) when running from a pull_request event.
109+
# Fallback to github.head_ref (sanity) or ref name for other contexts.
110+
target-branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref_name }}
109111

110112
unit-test:
111113
name: Unit Tests

.github/workflows/vulncheck.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ jobs:
2929
with:
3030
persist-credentials: false
3131
fetch-depth: 0
32-
# Prioritise inputs.target-branch, defaulting to PR head or current ref before falling back to 'main'.
33-
# Fixes default branch resolution issues observed during Go version upgrades.
34-
ref: ${{ inputs.target-branch || github.head_ref || github.ref_name || 'main' }}
32+
# For a pull_request event use the PR head branch (github.head_ref)
33+
# to this ensures vulncheck runs against the feature branch.
34+
# Otherwise, fall back to inputs.target-branch, github.ref_name, then 'main'.
35+
ref: ${{ (github.event_name == 'pull_request' && github.head_ref) || inputs.target-branch || github.ref_name || 'main' }}
3536

3637
- name: Check Go version
3738
id: get-go-version

0 commit comments

Comments
 (0)