Skip to content

Commit f918059

Browse files
committed
Trying to make the match a String
1 parent f2e6c3c commit f918059

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Jenkinsfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,12 +616,7 @@ def resolveBranchNo(String featureBranchPRMinusNo) {
616616
}
617617

618618
def resolveBranchName(String featureBranchPRMinusNo, String orgName, String repoName) {
619-
// get pull request number
620-
def branchNoMatcher = featureBranchPRMinusNo =~ /PR-(.*)/
621-
assert branchNoMatcher.find()
622-
623-
String prNo = branchNoMatcher[0][1]
624-
log("i", "PR number: " + prNo + " of class " + prNo.getClass())
619+
def prNo = extractPrNumber(featureBranchPRMinusNo)
625620

626621
// curl the repo based on the feature branch no to get the branch information
627622
/// Note: only works for public repos! Otherwise credentials needs to be passed
@@ -633,6 +628,16 @@ def resolveBranchName(String featureBranchPRMinusNo, String orgName, String repo
633628
return branchName
634629
}
635630

631+
def extractPrNumber(String featureBranchPRMinusNo) {
632+
// get pull request number
633+
def branchNoMatcher = featureBranchPRMinusNo =~ /PR-(.*)/
634+
assert branchNoMatcher.find()
635+
636+
String prNo = branchNoMatcher[0][1]
637+
log("i", "PR number: " + prNo + " of class " + prNo.getClass())
638+
return prNo
639+
}
640+
636641
def curlByPR(String prId, String orgName, String repoName) {
637642
def curlUrl = "set +x && curl -s https://api.github.com/repos/" + orgName + "/" + repoName + "/pulls/" + prId
638643
String jsonResponseString = sh(script: curlUrl, returnStdout: true)

0 commit comments

Comments
 (0)