Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
id: line-head
run: |
set -euo pipefail
HEAD_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/heads/$GITHUB_REF_NAME" | cut -f 1)
# ls-remote also lists refs whose names end in this one, so keep only the exact ref.
HEAD_SHA=$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" "refs/heads/$GITHUB_REF_NAME" | awk -v ref="refs/heads/$GITHUB_REF_NAME" '$2 == ref {print $1}')
if [ "$HEAD_SHA" = "$GITHUB_SHA" ]; then
echo "current=true" >> "$GITHUB_OUTPUT"
else
Expand Down Expand Up @@ -332,7 +333,8 @@ jobs:
TAG: ${{ needs.check.outputs.version }}
run: |
set -euo pipefail
if git ls-remote --exit-code --tags origin "$TAG" >/dev/null 2>&1; then
# ls-remote also lists refs whose names end in the tag's, so look for the exact ref.
if git ls-remote origin "refs/tags/$TAG" | awk -v ref="refs/tags/$TAG" '$2 == ref {found = 1} END {exit !found}'; then
echo "Tag $TAG already exists, skipping"
exit 0
fi
Expand Down
Loading