Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/codeql-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
ref: ${{ format('refs/pull/{0}/merge', github.event.pull_request.number) }}
# GitHub can omit the synthetic merge ref for stacked/non-default-base PRs;
# the event's merge SHA is the exact merge-result identity we must analyze.
ref: ${{ github.event.pull_request.merge_commit_sha }}
Comment thread
seonghobae marked this conversation as resolved.

- name: Initialize CodeQL
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
Expand All @@ -208,7 +210,7 @@ jobs:
category: "/language:${{ matrix.language }}-merge"
upload: false
output: codeql-results-merge
ref: ${{ format('refs/pull/{0}/merge', github.event.pull_request.number) }}
ref: ${{ github.event.pull_request.merge_commit_sha }}
sha: ${{ github.event.pull_request.merge_commit_sha }}
Comment thread
seonghobae marked this conversation as resolved.

- name: Enforce CodeQL Medium+ SARIF gate
Expand Down
3 changes: 2 additions & 1 deletion tests/test_codeql_pr_workflow_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def test_codeql_pr_workflow_gates_head_and_merge_sarif_locally() -> None:
assert "github.event.pull_request.head.sha" in workflow
assert "github.event.pull_request.merge_commit_sha" in workflow
assert "refs/pull/{0}/head" in workflow
assert "refs/pull/{0}/merge" in workflow
assert workflow.count("ref: ${{ github.event.pull_request.merge_commit_sha }}") == 2
assert "refs/pull/{0}/merge" not in workflow
assert workflow.count("security-events: read") == 2
assert "security-events: write" not in workflow

Expand Down
Loading