diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c46a843..17a176d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -141,13 +141,12 @@ jobs: echo "Promoting ${BASELINE} to stable release; current HEAD is a descendant." exit 0 fi - if ! git merge-base --is-ancestor "${BASELINE}" HEAD; then - echo "ERROR: ${BASELINE} is not an ancestor of HEAD; select a Previous Release tag from this branch." - exit 1 - fi - count="$(git rev-list --count "${BASELINE}..HEAD")" - if [ "$count" -eq 0 ]; then - echo "ERROR: No new commits since ${BASELINE}; refusing to create a duplicate release." + # BASELINE may not be a true git ancestor of HEAD (e.g. it was squash-merged + # into this branch's history rather than true-merged), so ancestry can't be + # relied on here. Compare tree content instead: if HEAD's tree is identical to + # BASELINE's, there's nothing new to release. + if [ "$(git rev-parse "${BASELINE}^{tree}")" = "$(git rev-parse "HEAD^{tree}")" ]; then + echo "ERROR: No changes since ${BASELINE} (working tree is identical); refusing to create a duplicate release." exit 1 fi