Skip to content

Commit

Permalink
Back to making PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromorales committed Aug 25, 2021
1 parent ac223fa commit 1ff597f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
set -e
set -x

if [ $INPUT_DESTINATION_HEAD_BRANCH == "main" ] || [ $INPUT_DESTINATION_HEAD_BRANCH == "master"]
then
echo "Destination head branch cannot be 'main' nor 'master'"
return -1
fi

if [ -z "$INPUT_PULL_REQUEST_REVIEWERS" ]
then
PULL_REQUEST_REVIEWERS=$INPUT_PULL_REQUEST_REVIEWERS
Expand All @@ -22,7 +28,7 @@ git clone "https://[email protected]/$INPUT_DESTINATION_REPO.git" "$C

cd "$CLONE_DIR"
git remote add upstream "https://$API_TOKEN_GITHUB@github.com/$GITHUB_REPOSITORY.git"
git checkout "$INPUT_DESTINATION_HEAD_BRANCH"
git checkout -b "$INPUT_DESTINATION_HEAD_BRANCH-$GITHUB_SHA"

echo "Fetching upstream"
git fetch upstream
Expand All @@ -32,3 +38,6 @@ git merge upstream/master --log -m 'Merge upstream/master'

echo "Pushing git commit"
git push -u origin HEAD:$INPUT_DESTINATION_HEAD_BRANCH
echo "Creating a pull request"
gh pr create -f -R $INPUT_DESTINATION_REPO \
$PULL_REQUEST_REVIEWERS

0 comments on commit 1ff597f

Please sign in to comment.