Skip to content

Commit edd57bd

Browse files
fix(ci): support PR gates in private repositories (#11048)
fix(ci): use fetched base ref in PR gate
1 parent 95b3d32 commit edd57bd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/pr-gate.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ jobs:
117117
env:
118118
BASE_REF: ${{ github.base_ref }}
119119
run: |
120-
git fetch --no-tags origin "$BASE_REF"
121-
echo "rev=$(git merge-base FETCH_HEAD HEAD)" >> "$GITHUB_OUTPUT"
120+
# `fetch-depth: 0` populates the base branch without persisting credentials.
121+
echo "rev=$(git merge-base "origin/$BASE_REF" HEAD)" >> "$GITHUB_OUTPUT"
122122
- uses: ./.github/actions/setup-zebra-build
123123
- uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 # v2.9
124124
with:
@@ -152,8 +152,8 @@ jobs:
152152
run: |
153153
set -euo pipefail
154154
155-
git fetch --no-tags origin "$BASE_REF"
156-
merge_base="$(git merge-base FETCH_HEAD HEAD)"
155+
# `fetch-depth: 0` populates the base branch without persisting credentials.
156+
merge_base="$(git merge-base "origin/$BASE_REF" HEAD)"
157157
158158
allowed_type=false
159159
case "$DECLARED_TYPE" in

0 commit comments

Comments
 (0)