Skip to content

Write HTML. Render video. Built for agents.

ci: compare test reachability against the merge ref's base parent (#4303)

Miguel Ángel8027c758d1d5
diff --git a/.github/workflows/catalog-previews.yml b/.github/workflows/catalog-previews.yml
index e6c0d3ddea..1c0feff3e4 100644
--- a/.github/workflows/catalog-previews.yml
+++ b/.github/workflows/catalog-previews.yml
@@ -69,9 +69,11 @@ jobs:
uses: ./.github/actions/install-ffmpeg-linux
- name: Render changed block/component previews
- env:
- BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
+ # HEAD is the PR merge ref; its first parent is the current base tip,
+ # unlike the event payload's base.sha, which can go stale.
+ BASE_SHA="$(git rev-parse HEAD^1)"
+
# Find which blocks/components changed in this PR. The trailing slash
# in the grep matters: an item is a directory, and a file sitting
# directly under registry/components (CATALOG.md) does not match the
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81fd4e1349..e3f829bc75 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,9 +39,10 @@ jobs:
node-version: 22
- name: Report base reachability
if: github.event_name == 'pull_request'
- env:
- BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ # HEAD is the PR merge ref; its first parent is the current base tip,
+ # which stays correct even when pull_request.base.sha is stale.
run: |
+ BASE_SHA="$(git rev-parse HEAD^1)"
git worktree add --detach "$RUNNER_TEMP/reachability-base" "$BASE_SHA"
(cd "$RUNNER_TEMP/reachability-base" && node scripts/check-test-reachability.mjs --report)
git worktree remove "$RUNNER_TEMP/reachability-base"