diff --git a/entrypoint.sh b/entrypoint.sh index 2b06918..498c6c1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,7 +7,7 @@ tectonic $1 OUTPUT_PDF="${1%.*}.pdf" -STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" -i -X PUT -H "Authorization: token $GITHUB_TOKEN" -d '{ +echo '{ "message": "'"update $OUTPUT_PDF"'", "committer": { "name": "Tectonic Action", @@ -15,7 +15,11 @@ STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" -i -X }, "content": "'"$(base64 -w 0 $OUTPUT_PDF)"'", "sha": '$(curl -X GET https://api.github.com/repos/vinay0410/webpage/contents/$OUTPUT_PDF | jq .sha)' -}' https://api.github.com/repos/vinay0410/webpage/contents/$OUTPUT_PDF) +}' >> payload.json + +STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" \ + -i -X PUT -H "Authorization: token $GITHUB_TOKEN" -d @payload.json \ + https://api.github.com/repos/vinay0410/webpage/contents/$OUTPUT_PDF) if [ $((STATUSCODE/100)) -ne 2 ]; then echo "Github's API returned $STATUSCODE"