Skip to content

Commit

Permalink
kie-issues#776: automate PR merge into protected branches (#2047)
Browse files Browse the repository at this point in the history
Co-authored-by: jstastny-cz <jan.stastny@ibm.com>
  • Loading branch information
jstastny-cz and jstastny-cz authored May 13, 2024
1 parent e27989e commit 4f8e744
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pipeline {
steps {
script {
dir(getRepoName()) {
approveAndMergePR(getDeployPrLink())
checkoutRepo()
mergeAndPush(getDeployPrLink())
tagLatest()
}
}
Expand All @@ -58,10 +58,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())
}
}
}
Expand Down Expand Up @@ -169,10 +169,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())
}
}

Expand Down

0 comments on commit 4f8e744

Please sign in to comment.