Skip to content

Commit 57ed858

Browse files
committed
Fix shallow merge-base handling for component fixtures
Increase the history depth to 150 and skip screenshot comparison with an explicit warning if the merge base is still unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7defd909-5470-4f45-97dc-09706d9c6570
1 parent 9eebd94 commit 57ed858

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/component-fixtures.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
with:
3131
# Need enough history for the merge-base lookup below to succeed even
3232
# when the target branch has advanced since the PR was opened. Full
33-
# clone would be wasteful for this large repo, so cap at 50.
34-
fetch-depth: 50
33+
# clone would be wasteful for this large repo, so cap at 150.
34+
fetch-depth: 150
3535

3636
- name: Setup Node.js
3737
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -184,8 +184,11 @@ jobs:
184184
if [ "${{ github.event_name }}" = "pull_request" ]; then
185185
# For PRs, diff against the merge-base with the target branch.
186186
TARGET_REF="origin/$BASE_REF"
187-
git fetch --no-tags --depth=50 origin "$BASE_REF"
188-
BASE_SHA=$(git merge-base "$EVENT_SHA" "$TARGET_REF")
187+
git fetch --no-tags --depth=150 origin "$BASE_REF"
188+
if ! BASE_SHA=$(git merge-base "$EVENT_SHA" "$TARGET_REF"); then
189+
echo "::warning::Unable to find a merge base between $EVENT_SHA and $TARGET_REF. The depth-150 shallow history may not contain their common ancestor; skipping screenshot comparison."
190+
exit 0
191+
fi
189192
else
190193
# For push events, diff against the parent commit.
191194
BASE_SHA=$(git rev-parse "$EVENT_SHA^")
@@ -229,6 +232,7 @@ jobs:
229232

230233
- name: Fetch base commit manifest
231234
id: base_manifest
235+
if: steps.base.outputs.base_sha != ''
232236
env:
233237
BASE_SHA: ${{ steps.base.outputs.base_sha }}
234238
run: |
@@ -250,7 +254,7 @@ jobs:
250254
251255
- name: Diff screenshots
252256
id: diff
253-
if: always()
257+
if: always() && steps.base.outputs.base_sha != ''
254258
run: |
255259
node build/lib/screenshotDiffReport.ts \
256260
https://hediet-screenshots.azurewebsites.net \

0 commit comments

Comments
 (0)