Skip to content

Commit

Permalink
ci: fix artifact deletion (#3437)
Browse files Browse the repository at this point in the history
GitHub seemingly now adds a newline to the output of the gh CLI, so we need to cut it before using it.
  • Loading branch information
msanft authored Oct 17, 2024
1 parent 24af06b commit 50df354
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions .github/actions/artifact_delete/delete_artifact.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 50df354

Please sign in to comment.