Forked from matthewprenger/changelog-auth.gradle
Last active
August 29, 2015 14:28
-
-
Save tterrag1098/b73ea2ae85215efac38a to your computer and use it in GitHub Desktop.
Jenkins Gradle Changelog Init Script, place this in ~/.gradle/init.d/changelog.gradle on your Jenkins server. Projects can simply call 'project.changelog' to get the changes for the current build.
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 buildUrl = System.getenv().BUILD_URL | |
if (buildUrl != null) { | |
def auth = "<USER>:<APITOKEN>".getBytes().encodeBase64().toString() | |
def url = new URL("$buildUrl/api/xml?depth=20").openConnection() | |
url.setRequestProperty("Authorization", "Basic " + auth) | |
String data = url.getInputStream().text | |
def changelog = "" | |
def xml = new XmlSlurper().parseText(data) | |
xml.changeSet.item.each { change -> | |
changelog += "$change.author.fullName: $change.msg" + '\n' | |
} | |
allprojects { | |
project.ext.changelog = changelog | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment