Skip to content

Commit

Permalink
Merge pull request #2 from vinay0410/fix/large-files
Browse files Browse the repository at this point in the history
fix(push): read curl payload from file
  • Loading branch information
vinay0410 authored Nov 22, 2019
2 parents 862b32c + b672e65 commit de0ea44
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": "tectonic-action@github.com"
},
"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 de0ea44

Please sign in to comment.