fix: retentionDays optional

This commit is contained in:
ange 2025-01-08 06:27:35 +00:00
parent a32b81ed6a
commit b643965497
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D

View File

@ -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