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