Skip to content

Instantly share code, notes, and snippets.

@pbuyle
Last active October 8, 2018 14:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbuyle/7197390 to your computer and use it in GitHub Desktop.
Save pbuyle/7197390 to your computer and use it in GitHub Desktop.
Groovy script to get a list of Git branches for a GitLab managed repository, usable with Jenkins Extensible Choice plugin.
project_id = 1
private_token = "XXXXXXXXXXXXXXXXXXXX"
return new groovy.json.JsonSlurper().parseText(new URL("https://git.pheromone.ca/api/v3/projects/"+project_id+"/repository/branches?private_token="+private_token).text).name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment