ci: fix artifact deletion (#3437)

GitHub seemingly now adds a newline to the output of the gh CLI, so we need to cut it before using it.
This commit is contained in:
Moritz Sanft 2024-10-17 09:37:59 +02:00 committed by GitHub
parent 24af06b02f
commit 50df35438e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# get_artifact_id retrieves the artifact id of
# an artifact that was generated by a workflow.
@ -9,7 +9,7 @@ function get_artifact_id {
-H "X-GitHub-Api-Version: 2022-11-28" \
--paginate \
"/repos/edgelesssys/constellation/actions/runs/$1/artifacts" --jq ".artifacts |= map(select(.name==\"$2\")) | .artifacts[0].id" || exit 1)"
echo "$artifact_id"
echo "$artifact_id" | tr -d "\n"
}
# delete_artifact_by_id deletes an artifact by its artifact id.
@ -25,14 +25,7 @@ function delete_artifact_by_id {
workflow_id="$1"
artifact_name="$2"
if [[ -z $workflow_id ]]; then
echo "[X] No workflow id provided."
echo "Usage: delete_artifact.sh <WORKFLOW_ID> <ARTIFACT_NAME>"
exit 1
fi
if [[ -z $artifact_name ]]; then
echo "[X] No artifact name provided."
if [[ -z $workflow_id ]] || [[ -z $artifact_name ]]; then
echo "Usage: delete_artifact.sh <WORKFLOW_ID> <ARTIFACT_NAME>"
exit 1
fi