fix(action): artifact is gzip compressed #9

Merged
jalil merged 1 commit from fix-action into main 2024-12-18 14:52:49 +01:00
Showing only changes of commit 7cc7a6f6f4 - Show all commits

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