From 54c9dc850d7d7575ecc93cf8879ef6defc34e6c2 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Tue, 21 Jan 2025 14:11:35 -0500 Subject: [PATCH] chore: Handle case with multiple artifacts (#5442) --- scripts/build-ui.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build-ui.sh b/scripts/build-ui.sh index 78b0cb5dd6..36e1f93efe 100755 --- a/scripts/build-ui.sh +++ b/scripts/build-ui.sh @@ -37,10 +37,11 @@ if which gh &> /dev/null; then echo "Found gh cli, attempting to download ui assets" artifact_id=$(gh api "repos/hashicorp/${REPO_NAME}/actions/artifacts" --paginate | \ - jq ".artifacts[] | select(.workflow_run.head_sha == \"${UI_COMMITISH}\" and .name == \"admin-ui-${UI_EDITION}\")" | \ + jq ".artifacts[] | select(.workflow_run.head_sha == \"${UI_COMMITISH}f\" and .name == \"admin-ui-${UI_EDITION}\")" | \ + jq --slurp '.[0]' | \ jq -r '.id') - if [[ ${artifact_id} ]]; then + if [[ "${artifact_id}" != "null" ]]; then echo "Downloading artifact: ${artifact_id} for admin-ui-${UI_EDITION} ${UI_COMMITISH}" tmp_dir=$(mktemp -d) gh api "repos/hashicorp/${REPO_NAME}/actions/artifacts/${artifact_id}/zip" > "${tmp_dir}/boundary-ui.zip"