From dca3642ab330078cd5b181552ea79ad60f04e734 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Mon, 19 Feb 2024 11:51:37 +0100 Subject: [PATCH] fix(get_draft_release.sh): filter draft release by version name to ensure correct release is retrieved (#165) fix(get_draft_release.sh): correctly extract upload URL from draft release object --- .github/get_draft_release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/get_draft_release.sh b/.github/get_draft_release.sh index e54812a7..d2fd0ab0 100644 --- a/.github/get_draft_release.sh +++ b/.github/get_draft_release.sh @@ -18,7 +18,7 @@ RELEASE=$(curl -s \ -H "Authorization: token $GITHUB_TOKEN" \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/releases" | - jq -r ".[] | select(.draft == true)") + jq -r --arg VERSION "$VERSION" '.[] | select(.draft == true and .name == $VERSION)') if [[ "${#RELEASE}" -eq 0 ]]; then echo "Draft release not found." @@ -31,7 +31,7 @@ case $KEY in echo "$HTML_URL" | rev | cut -d "/" -f1 | rev ;; UPLOAD_URL) - UPLOAD_URL=$(echo $RELEASE | jq -r 'first(.upload_url)') + UPLOAD_URL=$(echo $RELEASE | jq -r '.upload_url') echo "${UPLOAD_URL//{?name,label\}}" ;; esac \ No newline at end of file