Skip to content

Commit

Permalink
kie-issues#776: automate PR merge into protected branches
Browse files Browse the repository at this point in the history
  • Loading branch information
jstastny-cz authored and jstastny-cz committed May 13, 2024
1 parent db0f421 commit d108dc0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .ci/jenkins/Jenkinsfile.bump-up-version
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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())
}
}

0 comments on commit d108dc0

Please sign in to comment.