File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,28 @@ gh pr checkout --force "$PR_NUMBER" --repo "$UPSTREAM_REPO"
84
84
# 2. Push the branch to your fork
85
85
NEW_BRANCH_NAME=" test-pr-${PR_NUMBER} -${PR_AUTHOR} "
86
86
87
- echo " π Pushing changes to a new branch '${NEW_BRANCH_NAME} ' on your fork (${FORK_REMOTE} )..."
88
- # Force push in case the branch already exists from a previous test run
89
- git push " $FORK_REMOTE " " HEAD:${NEW_BRANCH_NAME} " --force
90
-
91
87
# check if we didn't already have a pull request open for this branch
92
88
already_opened_pr=$(
93
89
gh pr list --repo " $UPSTREAM_REPO " --head \
94
- " ${FORK_REMOTE} : ${ NEW_BRANCH_NAME}" --json url --jq ' .[0].url'
90
+ " ${NEW_BRANCH_NAME} " --json url --jq ' .[0].url'
95
91
)
92
+
93
+ if [[ -n ${already_opened_pr} ]]; then
94
+ echo " π A pull request already exists for this branch, pushing to the pull request target: ${already_opened_pr} "
95
+
96
+ gh pr list --repo openshift-pipelines/pipelines-as-code --head ${NEW_BRANCH_NAME} --json headRepositoryOwner,headRepository --jq ' .[0].headRepositoryOwner.login + "/" + .[0].headRepository.name'
97
+ ) "
98
+ echo " π¨ Pushing changes to existing pull request branch '${NEW_BRANCH_NAME} ' fork (${FORK_REMOTE} )..."
99
+ else
100
+
101
+ echo " π¨ Pushing changes to a new branch '${NEW_BRANCH_NAME} ' on your fork (${FORK_REMOTE} )..."
102
+ fi
103
+
104
+ # Force push in case the branch already exists from a previous test run
105
+ git push " $FORK_REMOTE " " HEAD:${NEW_BRANCH_NAME} " --force
106
+
96
107
if [[ -n ${already_opened_pr} ]]; then
97
- echo " π A pull request already exists for this branch: ${already_opened_pr} "
108
+ echo " π Pull request has successfully been synched ${already_opened_pr} "
98
109
exit 0
99
110
fi
100
111
You canβt perform that action at this time.
0 commit comments