From b643965497d06a6b18fd04360748fad9b4c2a624 Mon Sep 17 00:00:00 2001 From: ange Date: Wed, 8 Jan 2025 06:27:35 +0000 Subject: [PATCH] fix: retentionDays optional --- entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6568e5d..6fdd1f0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/bash -e API="$GITHUB_SERVER_URL/api/actions_pipeline/_apis/pipelines/workflows/$GITHUB_RUN_ID/artifacts" +[ -n "$INPUT_RETENTION_DAYS" ] && RETENTION="retentionDays=$INPUT_RETENTION_DAYS" CURL=(curl --fail -v -D/dev/stdout --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" --data '{"Type":"actions_storage","Name":"'"$INPUT_NAME"'"}' @@ -18,7 +19,7 @@ for artifact in $INPUT_PATH; do --header "x-actions-results-md5: $md5" \ --header "x-tfs-filelength: $content_length" \ --header "content-range: bytes 0-$((content_length - 1))/$content_length" \ - "$UPLOAD_URL?retentionDays=$INPUT_RETENTION_DAYS&itemPath=$INPUT_NAME%2F$artifact" + "$UPLOAD_URL?$RETENTION&itemPath=$INPUT_NAME%2F$artifact" cat resp1.json "${CURL[@]}" -XPATCH -oresp2.json "$API&artifactName=$INPUT_NAME" cat resp2.json