forked from molecule-ai/molecule-core
fix(ci/harness-replays): fetch base branch by name not SHA
git fetch origin <sha>:<sha> is not valid syntax for fetching an arbitrary commit (git needs a ref to locate the commit on the remote). Switch to git fetch origin main --depth=1 which fetches the main branch tip + its immediate parent. The base commit is the parent of the PR head on main, so depth=1 is sufficient. github.event.pull_request.base.ref = "main" (confirmed from API) — this is the branch name, not the SHA. git fetch origin main --depth=1 fetches the branch tip and one ancestor, giving us the base commit in a single cheap network call. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
eda6b987a2
commit
ff5186dbc3
@ -71,14 +71,15 @@ jobs:
|
||||
- name: Fetch base branch tip for diff
|
||||
run: |
|
||||
# With the default fetch-depth: 1, actions/checkout only fetches the
|
||||
# PR head commit. The base branch tip (github.event.pull_request.base.sha)
|
||||
# is NOT in the local history, so `git diff "$BASE" "$GITHUB_SHA"` fails
|
||||
# because neither ref is fully resolved. Fetch only the base branch at
|
||||
# depth 1 — one cheap network round-trip, sufficient for diff.
|
||||
# PR head commit. The base commit is NOT in the local history, so
|
||||
# `git diff "$BASE" "$GITHUB_SHA"` fails. Fetch the base branch tip
|
||||
# (which is github.event.pull_request.base.sha) at depth 1 — one
|
||||
# cheap round-trip, enough for the diff to work.
|
||||
#
|
||||
# Do NOT use fetch-depth: 0 here — the repo is 75+ MB and a full history
|
||||
# fetch times out on the operator-host runner network (github.com unreachable,
|
||||
# ~3s timeout to apt mirrors). A single-commit fetch avoids that.
|
||||
# github.event.pull_request.base.ref = "main" (confirmed via API).
|
||||
# git fetch origin main --depth=1 fetches the main branch tip + its
|
||||
# immediate parent (the base commit we need). This is faster and more
|
||||
# reliable than fetch-depth:0 (which times out on the 75 MB repo).
|
||||
git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=1
|
||||
- id: decide
|
||||
run: |
|
||||
|
||||
Loading…
Reference in New Issue
Block a user