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-kogito-examples.git


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

commit 85ea169fc99094d055418c5e4d1c16663169194a
Author: Jan Stastny <[email protected]>
AuthorDate: Mon May 13 10:49:24 2024 +0200

    kie-issues#776: automate PR merge into protected branches (#1914)
    
    Co-authored-by: jstastny-cz <[email protected]>
---
 .ci/jenkins/Jenkinsfile.promote | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index 0ae01a2f0..50caf0dd7 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -49,8 +49,8 @@ pipeline {
             steps {
                 script {
                     dir(getRepoName()) {
+                        approveAndMergePR(getDeployPrLink())
                         checkoutRepo()
-                        mergeAndPush(getDeployPrLink())
                         tagLatest()
                     }
                 }
@@ -63,10 +63,10 @@ pipeline {
                     dir(getRepoName()) {
                         checkoutRepo()
                         if (githubscm.isReleaseExist(getGitTag(), 
getGitAuthorCredsId())) {
-                            githubscm.deleteRelease(getGitTag(), 
getGitAuthorCredsId())
+                            githubscm.deleteRelease(getGitTag(), 
getGitAuthorPushCredsId())
                         }
-                        
githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), 
githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorCredsId())
-                        githubscm.updateReleaseBody(getGitTag(), 
getGitAuthorCredsId())
+                        
githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), 
githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorPushCredsId())
+                        githubscm.updateReleaseBody(getGitTag(), 
getGitAuthorPushCredsId())
                     }
                 }
             }
@@ -178,10 +178,10 @@ void checkoutRepo() {
     sh "git checkout ${getBuildBranch()}"
 }
 
-void mergeAndPush(String prLink) {
-    if (prLink) {
-        githubscm.mergePR(prLink, getGitAuthorCredsId())
-        githubscm.pushObject('origin', getBuildBranch(), 
getGitAuthorPushCredsId())
+void approveAndMergePR(String prLink) {
+    if (prLink?.trim()) {
+        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