Skip to content

Commit

Permalink
Fixed error handling when a commit fails to be pushed back to the mai…
Browse files Browse the repository at this point in the history
…n branch for new crate_universe binaries (bazelbuild#681)
  • Loading branch information
UebelAndre authored and yagehu committed Apr 23, 2021
1 parent 7f778a6 commit c64ffd7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/crate_universe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
# Write new defaults.bzl file
# Copy the new template
cp ${{ github.workspace }}/crate_universe/private/defaults.bzl.template ${{ github.workspace }}/crate_universe/private/defaults.bzl
# Replace the url
url="$(echo $URL | sed 's|releases/tag/|releases/download/|')/{bin}"
sed -i "s|{DEFAULT_URL_TEMPLATE}|${url}|" ${{ github.workspace }}/crate_universe/private/defaults.bzl
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
echo "No change to any binaries"
exit 0
fi
git stage ${GITHUB_WORKSPACE}/crate_universe/private/defaults.bzl && git status
# Setup git and commit back to the repo
Expand All @@ -200,15 +200,12 @@ jobs:
# have been merged before this pipeline gets to this point.
for i in 1 2 3 4 5 ; do
{
git push origin "${branch}" && break
git push origin "${branch}" && exit 0
} || {
sleep 10
git pull --rebase
}
done
# Ensure we've pushed our commit
if [[ -n "$(git diff "${branch}..HEAD")" ]]; then
echo "Failed to push changes"
exit 1
fi
echo "Failed to push commit to to repo"
exit 1

0 comments on commit c64ffd7

Please sign in to comment.