diff --git a/checkout/action.yml b/checkout/action.yml index dacd56c..842630f 100644 --- a/checkout/action.yml +++ b/checkout/action.yml @@ -12,7 +12,7 @@ inputs: description: 'Repository (owner/repo)' default: '${{ github.repository }}' ref: - description: 'Branch or tag to checkout' + description: 'Branch, tag or commit SHA to checkout' default: '${{ github.ref_name }}' depth: description: 'Clone depth (0 = full)' @@ -66,8 +66,16 @@ runs: git checkout FETCH_HEAD echo "Sparse checkout ${REPO}@${REF} ($(echo $SPARSE | wc -w) paths)" else - # Full clone - if [ "$TARGET" = "." ]; then + # Full clone. A SHA ref can't go through `clone --branch` (git: "Remote branch + # not found" — killed the 2026-11-06 sim publish of SHA f0e206ff3), so fetch + # it explicitly; the server allows anySHA fetch. Branch/tag refs keep the old path. + if echo "$REF" | grep -qE '^[0-9a-fA-F]{7,40}$'; then + mkdir -p "$TARGET" && cd "$TARGET" + git init + git remote add origin "$URL" + git fetch $DEPTH_FLAG origin "$REF" + git checkout FETCH_HEAD + elif [ "$TARGET" = "." ]; then git clone $DEPTH_FLAG --branch "$REF" "$URL" . else git clone $DEPTH_FLAG --branch "$REF" "$URL" "$TARGET"