Last active
September 6, 2017 10:41
-
-
Save perfectfoolish/1ca13195b12fd8c2217ff0c031f0c923 to your computer and use it in GitHub Desktop.
Install 'Extended Choice Parameter Plug-In', then selected 'Basic Parameter Types', input 'Number of Visible Items' with 100 and 'Delimiter' with ',', selected Groovy Script and input this script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gitURL = "[email protected]:xxxxx.git" | |
def command = "git ls-remote -h $gitURL" | |
def proc = command.execute() | |
proc.waitFor() | |
if ( proc.exitValue() != 0 ) { | |
return ["develop", "master"] | |
} | |
def branches = proc.in.text.readLines().collect { | |
it.replaceAll(/[a-z0-9]*\trefs\/heads\//, '') | |
} | |
branches -= ["develop", "master"] | |
branches = ["develop", "master"] + branches | |
return branches.join(",") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment