fix(action): artifact is gzip compressed

This is not reported to cURL however T-T
This commit is contained in:
Jalil David Salamé Messina 2024-12-18 14:51:45 +01:00
parent 34d976f6c5
commit 7cc7a6f6f4
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -79,15 +79,22 @@ runs:
}
# USAGE: has_report <RUN_URL>
has_report() {
http_code=$(curl -X 'GET' -o /dev/null --silent -Iw '%{http_code}' "$1/artifacts/$ARTIFACT_NAME")
http_code=$(curl -X 'GET' -o /dev/null --silent -Iw '%{http_code}' \
-H "Authorization: token $GITHUB_TOKEN" \
"$1/artifacts/$ARTIFACT_NAME")
test "$http_code" = '200'
}
# If we have a previous report compare against it
if [ "$JOB_NAME" ] && [ "$HEAD_BRANCH" ]; then
url=$(base_report_url)
echo "Found previous run at: $url"
if has_report "$url"; then
curl -X 'GET' -o old-report.json "$url/artifacts/$ARTIFACT_NAME"
curl -X 'GET' \
-H "Authorization: token $GITHUB_TOKEN" \
"$url/artifacts/$ARTIFACT_NAME" |
gunzip > old-report.json
echo 'Found previous report'
"$GITHUB_ACTION_PATH/comment_on_pr.sh" report.json old-report.json
exit 0
fi