Skip to content

Instantly share code, notes, and snippets.

@stanchan
Last active August 17, 2016 23:47
Show Gist options
  • Select an option

  • Save stanchan/374b897b36502240cbd02834a1f33faf to your computer and use it in GitHub Desktop.

Select an option

Save stanchan/374b897b36502240cbd02834a1f33faf to your computer and use it in GitHub Desktop.
script: |
def gitURL = "{scm-url}"
def getTags = ("git ls-remote -t -h $gitURL refs/tags/*").execute()
def getBranches = ("git ls-remote -t -h $gitURL feature/*").execute()
#return getBranches.text.readLines()
# .collect {{ it.split()[1].replaceAll('refs/heads/', '') }}
# .unique()
# .findAll {{ it.startsWith('<pattern>') }}
return getTags.text.readLines()
.collect {{ it.split()[1].replaceAll('refs/tags/', '') }}
.unique()
.findAll {{ it ~= /\d*\./\d*\.\d*/ }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment