Skip to content

Commit b693fac

Browse files
authored
fix(ci): Use merge base for OWASP plugin (#26524)
## Description Don't use trunk, because if a vulnerability fix has been merged, this requires PRs to rebase. Instead, try to find a merge base where possible and use that as the reference point to ensure no new vulnerabilities are being introduced by a PR. ## Motivation and Context Recent OWASP job failures ## Impact Less false positives from the OWASP job ## Test Plan Old commit without newer security vulnerability fixes doesn't trigger OWASP failure anymore: tdcmeehan#12 Previous vulnerability detection continues to work: tdcmeehan#13 ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. - [ ] If adding new dependencies, verified they have an [OpenSSF Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or higher (or obtained explicit TSC approval for lower scores). ## Release Notes ``` == NO RELEASE NOTE == ```
1 parent 0a4e2ad commit b693fac

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/owasp-dependency-check.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,24 @@ jobs:
2828
persist-credentials: false
2929
ref: ${{ github.event.pull_request.head.sha }}
3030

31+
- name: Find merge base
32+
id: merge-base
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
BASE_REF: ${{ github.event.pull_request.base.ref }}
36+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
37+
REPO: ${{ github.repository }}
38+
run: |
39+
merge_base=$(gh api -q '.merge_base_commit.sha' \
40+
"/repos/$REPO/compare/$BASE_REF...$HEAD_SHA")
41+
echo "sha=$merge_base" >> $GITHUB_OUTPUT
42+
echo "Using merge base: $merge_base"
43+
3144
- name: Checkout base branch
3245
uses: actions/checkout@v4
3346
with:
3447
persist-credentials: false
35-
ref: ${{ github.event.pull_request.base.sha }}
48+
ref: ${{ steps.merge-base.outputs.sha }}
3649
path: base
3750

3851
- name: Set up Java

0 commit comments

Comments
 (0)