summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBazaah2023-09-09 15:09:31 +0000
committerBazaah2023-09-09 17:10:46 +0000
commit9ca7efd18c4e772b6e41a759b78c6bd7c4d4e68c (patch)
tree61af9fc6442c8d6f2501d8541f503ece47200cd2
parent4cc7eb5a1fcd326587ddfc38224db727bb3a243b (diff)
downloadaur-9ca7efd18c4e772b6e41a759b78c6bd7c4d4e68c.tar.gz
gh-upload-artifact: try pretty print happy path of upload
If curl returns success, assume the result is json and pipe through jq. This improves the output substantially as before it printed a compressed no-newline json blob for each artifact uploaded.
-rwxr-xr-xscripts.gh-upload-artifact.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts.gh-upload-artifact.sh b/scripts.gh-upload-artifact.sh
index 6747c52aea92..df01b07b152f 100755
--- a/scripts.gh-upload-artifact.sh
+++ b/scripts.gh-upload-artifact.sh
@@ -137,7 +137,12 @@ main() {
-H "$GH_AUTH" \
-H "Content-Type: $(file -b --mime-type $artifact)" \
--data-binary @"$artifact" \
+ -o "$GH_RESPONSE" \
$upload_uri
+
+ (( $? > 0 )) \
+ && die 1 "$(cat <(printf "Failed to upload $filename to $repo:\n") $GH_RESPONSE)" \
+ || jq '.' "$GH_RESPONSE"
fi
}