Skip to content

Commit 1a5eceb

Browse files
Merge pull request #1595 from ChrisRackauckas-Claude/fix/detect-changed-benchmarks-shallow-merge-base
Fix detect-changed-benchmarks: handle shallow base fetch (no merge base)
2 parents 43fa749 + 5d0a56d commit 1a5eceb

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)