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

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


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

commit 08fe6a26c47ffc29c60c908f88335a5840a9eec2
Author: Jan Stastny <[email protected]>
AuthorDate: Mon May 13 10:48:35 2024 +0200

    kie-issues#776: automate PR merge into protected branches (#4536)
    
    Co-authored-by: jstastny-cz <[email protected]>
---
 .ci/jenkins/Jenkinsfile.kie-kogito-post-release | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.kie-kogito-post-release 
b/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
index d7104a254..dd243cb28 100644
--- a/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
+++ b/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
@@ -153,9 +153,7 @@ pipeline {
                     script{
                         // Add changed files, commit, open and merge PR
                         String prLink = commitAndCreatePR(commitMsg, 
PR_BRANCH, getDocsRepoBranch())
-                        sh "git checkout ${getDocsRepoBranch()}"
-                        mergeAndPush(prLink, getDocsRepoBranch())
-                        githubscm.removeRemoteBranch('origin', PR_BRANCH, 
getGitAuthorPushCredsId())
+                        approveAndMergePR(prLink)
                     }
                 }
             }
@@ -241,10 +239,10 @@ String parseCommunityVersion(String docVersion) {
     return "${versionSplit[0]}.${versionSplit[1]}"
 }
 
-void mergeAndPush(String prLink, String targetBranch) {
+void approveAndMergePR(String prLink) {
     if (prLink?.trim()) {
+        githubscm.approvePR(prLink, getGitAuthorPushCredsId())
         githubscm.mergePR(prLink, getGitAuthorPushCredsId())
-        githubscm.pushObject('origin', targetBranch, getGitAuthorPushCredsId())
     }
 }
 
@@ -253,5 +251,5 @@ 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, 
getGitAuthorPushCredsId())
-}
\ No newline at end of file
+    return githubscm.createPR(commitMsg, prBody, targetBranch, 
getGitAuthorCredsId())
+}


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

Reply via email to