@@ -616,12 +616,7 @@ def resolveBranchNo(String featureBranchPRMinusNo) {
616
616
}
617
617
618
618
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)
625
620
626
621
// curl the repo based on the feature branch no to get the branch information
627
622
// / Note: only works for public repos! Otherwise credentials needs to be passed
@@ -633,6 +628,16 @@ def resolveBranchName(String featureBranchPRMinusNo, String orgName, String repo
633
628
return branchName
634
629
}
635
630
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
+
636
641
def curlByPR (String prId , String orgName , String repoName ) {
637
642
def curlUrl = " set +x && curl -s https://api.github.com/repos/" + orgName + " /" + repoName + " /pulls/" + prId
638
643
String jsonResponseString = sh(script : curlUrl, returnStdout : true )
0 commit comments