Skip to content

Commit

Permalink
Merge pull request #33 from RicardoMonteiroSimoes/master
Browse files Browse the repository at this point in the history
Added functionality to create new branch if target doesnt exist
  • Loading branch information
andstor authored Apr 18, 2020
2 parents be4b92e + d1565bb commit 3a322de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,15 @@ fi

git clone --branch ${DST_BRANCH} --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
if [ "$?" -ne 0 ]; then
echo >&2 "Cloning '$DST_REPO' failed"
exit 1
echo >&2 "Cloning branch '$DST_BRANCH' in '$DST_REPO' failed"
echo >&2 "Falling back to default branch"
git clone --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
echo >&2 "Creating branch '$DST_BRANCH'"
git checkout -b ${DST_BRANCH}
if [ "$?" -ne 0 ]; then
echo >&2 "Creation of Branch '$DST_BRANCH' failed"
exit 1
fi
fi

if [ "$CLEAN" = "true" ]; then
Expand Down

0 comments on commit 3a322de

Please sign in to comment.