def createPRWithLabels()

in jenkins-pipeline-shared-libraries/vars/githubscm.groovy [176:186]


def createPRWithLabels(String pullRequestTitle, String pullRequestBody = '', String targetBranch = 'main', String[] labels, String credentialID = 'kie-ci') {
    def pullRequestLink
    try {
        pullRequestLink = executeGHCli("gh pr create -t '${pullRequestTitle }' -b '${pullRequestBody }' -B '${targetBranch }' -l ${labels.collect { it -> "'${it }'" }.join(',')}", credentialID)
    } catch (Exception e) {
        println "[ERROR] Unable to create PR. Please make sure the targetBranch ${targetBranch} is correct."
        throw e
    }
    println "Please see the created PR at: ${pullRequestLink}"
    return pullRequestLink
}