Skip to content

Commit a1b0e76

Browse files
authored
Retry for failed pushes (#150)
* Retry for failed pushes * Nothing escape the Eye of Sauron
1 parent 1557927 commit a1b0e76

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/build_main_documentation.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ jobs:
116116
if [[ `git status --porcelain` ]]; then
117117
git add .
118118
git commit -m "Updated with commit ${{ inputs.commit_sha }} See: https://github.com/huggingface/${{ inputs.package }}/commit/${{ inputs.commit_sha }}"
119-
git push origin main
119+
git push origin main ||
120+
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin main) ||
121+
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin main)
120122
else
121123
echo "No diff in the documentation."
122124
fi
@@ -134,7 +136,9 @@ jobs:
134136
if [[ `git status --porcelain` ]]; then
135137
git add ${{ inputs.notebook_folder }}
136138
git commit -m "Updated ${{ inputs.package }} doc notebooks with commit ${{ inputs.commit_sha }} \n\nSee: https://github.com/huggingface/${{ inputs.package }}/commit/${{ inputs.commit_sha }}"
137-
git push origin master
139+
git push origin master ||
140+
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin master) ||
141+
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin master)
138142
else
139143
echo "No diff in the notebooks."
140144
fi

.github/workflows/build_pr_documentation.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ jobs:
8989
if [[ `git status --porcelain` ]]; then
9090
git add .
9191
git commit -m "Updated with commit ${{ inputs.commit_sha }} See: https://github.com/huggingface/${{ inputs.package }}/commit/${{ inputs.commit_sha }}"
92-
git push origin main
92+
git push origin main ||
93+
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin main) ||
94+
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin main)
9395
else
9496
echo "No diff in the documentation."
9597
fi

.github/workflows/delete_doc_comment.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
if [[ `git status --porcelain` ]]; then
4141
git add .
4242
git commit -m "Closed PR ${{ inputs.pr_number }} in ${{ inputs.package }}"
43-
git push origin main
43+
git push origin main ||
44+
(echo "Failed on the first try, rebasing and pushing again" && git pull --rebase && git push origin main) ||
45+
(echo "Failed on the second try, rebasing and pushing again" && git pull --rebase && git push origin main)
4446
else
4547
echo "Branch was already deleted, nothing to do."
4648
fi

0 commit comments

Comments
 (0)