Skip to content

Commit

Permalink
fix(push): read curl payload from file
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay0410 committed Nov 22, 2019
1 parent 862b32c commit b672e65
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ 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",
"email": "[email protected]"
},
"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"
Expand Down

0 comments on commit b672e65

Please sign in to comment.