From 15fe523e9d4a2ea1542e3727a6b83e2a18d7995b Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Nov 2026 19:50:03 +0100 Subject: [PATCH] Leave the workflow's checkout alone when comparing with the base branch The base step fetched the commits it compares with into the workflow's own checkout with --depth=1. In a checkout that was already complete, that cut the history of the commits it had, and a step after it that reads the version from tags, such as MinVer, found none. The commits are fetched into a repository of their own. Co-Authored-By: Claude Sonnet 5.5 --- action.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index da93915..1975538 100644 --- a/action.yml +++ b/action.yml @@ -204,11 +204,16 @@ runs: skip() { echo "::warning title=assembly-differ::$1; the check follows the comparison with the latest release"; exit 0; } - # the committed API of a commit, in a directory of its own; nothing when the commit has none + # The committed API of a commit, in a directory of its own; nothing when the commit has none. The commits are fetched + # into a repository of their own: a shallow fetch into the workflow's checkout cuts the history of a commit it + # already has, and the steps after this one, such as a version from tags, would find none. + scratch="$work/git" + git init --quiet --bare "$scratch" + remote=$(git remote get-url origin) export_api() { mkdir -p "$2" - git -c "http.https://github.com/.extraheader=$header" fetch --quiet --no-tags --depth=1 origin "$1" || return 1 - git archive "$1" -- "$prefix" 2>/dev/null | tar -x -C "$2" || true + git -C "$scratch" -c "http.https://github.com/.extraheader=$header" fetch --quiet --no-tags --depth=1 "$remote" "$1" || return 1 + git -C "$scratch" archive "$1" -- "$prefix" 2>/dev/null | tar -x -C "$2" || true } tip() { gh api "repos/$REPOSITORY/git/ref/heads/$1" --jq .object.sha; }