Skip to content

Instantly share code, notes, and snippets.

@guilhermelinhares
Last active November 17, 2022 14:43
Show Gist options
  • Save guilhermelinhares/587efb18a2d6b0fa06f4041cdbe1a9bc to your computer and use it in GitHub Desktop.
Save guilhermelinhares/587efb18a2d6b0fa06f4041cdbe1a9bc to your computer and use it in GitHub Desktop.
List Tags Groovy Script - Git Jenkins Active Choices Parameter
git ls-remote -t -h
# -t = tag
# -h = header
def gettags = ("git ls-remote -t https://github.com/repo.git").execute()
return gettags.text.readLines().collect {
it.split()[1].replaceAll('refs/heads/', '').replaceAll('refs/tags/', '').replaceAll("\\^\\{\\}", '')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment