This is an automated email from the ASF dual-hosted git repository.

jstastnycz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-benchmarks.git


The following commit(s) were added to refs/heads/main by this push:
     new d108dc04 kie-issues#776: automate PR merge into protected branches
d108dc04 is described below

commit d108dc046ff8ee921f7d302f09b7b389bec23373
Author: jstastny-cz <[email protected]>
AuthorDate: Fri May 10 09:45:23 2024 +0200

    kie-issues#776: automate PR merge into protected branches
---
 .ci/jenkins/Jenkinsfile.bump-up-version | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.bump-up-version 
b/.ci/jenkins/Jenkinsfile.bump-up-version
index ed8c38e5..bc53d72e 100644
--- a/.ci/jenkins/Jenkinsfile.bump-up-version
+++ b/.ci/jenkins/Jenkinsfile.bump-up-version
@@ -45,9 +45,7 @@ pipeline {
                         githubscm.createBranch(localBranch)
                         
maven.mvnSetVersionProperty("version.org.${getUpdateRepoName()}", getVersion())
                         String prLink = commitAndCreatePR(commitMsg, 
localBranch, "${getTargetBranch()}")
-                        sh "git checkout ${getTargetBranch()}"
-                        mergeAndPush(prLink, "${getTargetBranch()}")
-                        githubscm.removeRemoteBranch('origin', localBranch, 
getGitAuthorPushCredsId())
+                        approveAndMergePR(prLink)
                     }
                 }
             }
@@ -96,13 +94,12 @@ String commitAndCreatePR(String commitMsg, String 
localBranch, String targetBran
     githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
     githubscm.commitChanges(commitMsg)
     githubscm.pushObject('origin', localBranch, getGitAuthorPushCredsId())
-    return githubscm.createPR(commitMsg, prBody, 
targetBranch,getGitAuthorCredsId())
+    return githubscm.createPR(commitMsg, prBody, targetBranch, 
getGitAuthorCredsId())
 }
 
-void mergeAndPush(String prLink, String targetBranch) {
+void approveAndMergePR(String prLink) {
     if (prLink?.trim()) {
-        githubscm.mergePR(prLink, getGitAuthorCredsId())
-        githubscm.pushObject('origin', targetBranch, getGitAuthorPushCredsId())
+        githubscm.approvePR(prLink, getGitAuthorPushCredsId())
+        githubscm.mergePR(prLink, getGitAuthorPushCredsId())
     }
 }
-


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to