in jenkins-pipeline-shared-libraries/vars/githubscm.groovy [415:426]
def hasForkPullRequest(String group, String repository, String author, String branch, String credentialsId = 'kie-ci1-token') {
def result = false
withCredentials([string(credentialsId: credentialsId, variable: 'OAUTHTOKEN')]) {
def curlResult = sh(returnStdout: true, script: "curl --globoff -H \"Authorization: token ${OAUTHTOKEN}\" 'https://api.github.com/repos/${group}/${repository}/pulls?head=${author}:${branch}&state=open'")?.trim()
if (curlResult) {
def pullRequestJsonObject = readJSON text: curlResult
result = pullRequestJsonObject.size() > 0
}
}
println "[INFO] has pull request for ${group}/${repository}:${author}:${branch} -> ${result}"
return result
}