Skip to content

Commit

Permalink
Update entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
himadrisingh committed Aug 12, 2020
1 parent 0dbf1b3 commit 9521f5e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ echo "Last commited SHA: ${last_sha}"
up_to_date=$(git_cmd git rev-list origin/${INPUT_BRANCH} | grep ${last_sha} | wc -l)
pr_branch="up-${last_sha}"

hub pr list
pr_exists=$(git_cmd hub pr list | grep ${last_sha} | wc -l)

if [[ "${pr_exists}" -gt 0 ]]; then
echo "PR Already exists!!!"
git_cmd hub pr list | grep ${last_sha}
exit 0
fi

if [[ "${up_to_date}" -eq 0 ]]; then
git_cmd git checkout -b "${pr_branch}" --track "upstream/${INPUT_UPSTREAM_BRANCH}"
git_cmd git push -u origin "${pr_branch}"
git_cmd git remote remove upstream
git_cmd hub pull-request -b "${INPUT_BRANCH}" -h "${pr_branch}" -l "${INPUT_PR_LABELS}" -a "${GITHUB_ACTOR}" -m "\"Upstream: ${last_sha}\""

hub pr list
pr_exists=$(git_cmd hub pr list | grep ${last_sha} | wc -l)

if [[ "${pr_exists}" -gt 0 ]]; then
echo "PR Already exists!!!"
exit 0
else
git_cmd hub pull-request -b "${INPUT_BRANCH}" -h "${pr_branch}" -l "${INPUT_PR_LABELS}" -a "${GITHUB_ACTOR}" -m "\"Upstream: ${last_sha}\""
fi
else
echo "Branch up-to-date"
exit 0
Expand Down

0 comments on commit 9521f5e

Please sign in to comment.