Skip to content

Commit 43ecb6c

Browse files
committed
Resolve annotated tags to the commit instead of the tag object
1 parent 874c42d commit 43ecb6c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/actions/setup-wolfssl/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ runs:
3535
if [[ "$ref" =~ ^[0-9a-f]{40}$ ]]; then
3636
sha="$ref"
3737
else
38-
sha=$(git ls-remote https://github.com/wolfSSL/wolfssl.git "$ref" "refs/tags/$ref^{}" \
39-
| head -n1 | cut -f1)
38+
# An annotated tag resolves to the tag object, not the commit, so ask
39+
# for the peeled ref first and fall back for branches.
40+
sha=$(git ls-remote https://github.com/wolfSSL/wolfssl.git \
41+
"refs/tags/$ref^{}" | cut -f1)
42+
[ -n "$sha" ] || sha=$(git ls-remote \
43+
https://github.com/wolfSSL/wolfssl.git "$ref" | head -n1 | cut -f1)
4044
fi
4145
[ -n "$sha" ] || { echo "could not resolve wolfSSL ref '$ref'"; exit 1; }
4246
echo "sha=$sha" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)