Skip to content

Commit 5d0a56d

Browse files
Make PR change-detection robust to shallow base fetch (no merge base)
detect-changed-benchmarks.sh fetches the PR base at --depth=1 and then runs a three-dot diff (origin/master...HEAD), which requires a merge base. Once master advances past the PR's branch point, the depth=1 base graft shares no ancestor with HEAD, so git aborts with "fatal: origin/master...HEAD: no merge base" (exit 128) and the Detect Changed Benchmarks job fails. This broke re-runs of e.g. #1581 and #1570. Suppress the three-dot error and fall back to diffing the PR merge commit against its first parent (HEAD~1 = base tip), which yields exactly the PR's changes without needing a merge base. This mirrors the existing robust pattern already used on the push path in the same script. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
1 parent 43fa749 commit 5d0a56d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/scripts/detect-changed-benchmarks.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ source "${SCRIPT_DIR}/read-benchmark-config.sh"
2020
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
2121
BASE_SHA="${GITHUB_BASE_REF}"
2222
git fetch origin "${BASE_SHA}" --depth=1 2>/dev/null || true
23-
CHANGED_FILES=$(git diff --name-only "origin/${BASE_SHA}...HEAD" -- 'benchmarks/')
23+
CHANGED_FILES=$(git diff --name-only "origin/${BASE_SHA}...HEAD" -- 'benchmarks/' 2>/dev/null || true)
24+
if [[ -z "${CHANGED_FILES}" ]]; then
25+
# The three-dot range needs a merge base, which a shallow (--depth=1)
26+
# fetch of the base lacks once master advances past the PR's branch
27+
# point — git then aborts with "no merge base". PR builds check out
28+
# refs/pull/N/merge, so HEAD~1 is the base tip; diffing against it
29+
# yields exactly the PR's changes without requiring a merge base.
30+
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD -- 'benchmarks/' 2>/dev/null || true)
31+
fi
2432
else
2533
# Push event: compare against the last commit that was successfully published
2634
# to SciMLBenchmarksOutput. This makes change detection cumulative — if a

0 commit comments

Comments
 (0)