def approvePR()

in jenkins-pipeline-shared-libraries/vars/githubscm.groovy [195:206]


def approvePR(String pullRequestLink, String credentialID = 'kie-ci') {
    withCredentials([usernamePassword(credentialsId: credentialID, usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) {
        try {
            setUserConfig("${GITHUB_USER}")
            sh "gh pr review ${pullRequestLink} --approve"
        } catch (Exception e) {
            println "[ERROR] Can't approve PR ${pullRequestLink} on repo."
            throw e
        }
        println "[INFO] Approved PR '${pullRequestLink}' on repo."
    }
}