Skip to content

Commit 1c53d49

Browse files
committed
Exit early if PR is from fork
1 parent b335250 commit 1c53d49

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

upload_travis.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
set +x
2+
if [ "${GH_TOKEN}" = "" ]; then
3+
echo "PDF not uploading because this is a PR from a fork"
4+
exit 0
5+
fi
6+
set -x
7+
18
export commit_id=`git log -1 --pretty=format:"%H"`
29

310
git config --global push.default simple
@@ -23,7 +30,21 @@ mv ../paper.pdf ${name}
2330
git add ${name}
2431
git commit -m "${msg} - [skip ci]."
2532

26-
#git push -q > /dev/null 2>&1
33+
PUSH_COUNTER=0
34+
until git push -q > /dev/null 2>&1
35+
do
36+
git fetch origin pdfs > /dev/null 2>&1
37+
git reset --hard origin/pdfs > /dev/null 2>&1
38+
mv ../paper.pdf ${name}
39+
git add ${name}
40+
git commit -m "${msg} - [skip ci]."
41+
42+
PUSH_COUNTER=$((PUSH_COUNTER + 1))
43+
if [ "$PUSH_COUNTER" -gt 3 ]; then
44+
echo "Push failed, aborting."
45+
exit 1
46+
fi
47+
done
2748

2849
#export payload='{"state":"success","target_url":"https://github.com/isuruf-bot/sympy-paper/blob/pdfs/'${name}'","description":"Pdf uploading succeeded!","context":"continuous-integration/latex-pdf"}'
2950

0 commit comments

Comments
 (0)