From e7dafcb94b4e81555fff375ecd7ab011c890e31b Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at> Date: Sat, 29 Aug 2015 11:02:48 +0200 Subject: [PATCH] not commiting changelogs in jenkins without changes :-) --- build.gradle | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 85afc0a..0321050 100644 --- a/build.gradle +++ b/build.gradle @@ -107,6 +107,9 @@ task changelog << { } fileChangelog.delete() + def nameUserCI = 'Jenkins' + def lastCommitByCI = false + def builder def commits; def numTags = tags.size() @@ -127,8 +130,12 @@ task changelog << { } } + if (commits != null && nameUserCI.equalsIgnoreCase(commits[0].committer.name)) { + lastCommitByCI = true + } + commits.grep { commit -> - !'jenkins'.equalsIgnoreCase(commit.committer.name) + !nameUserCI.equalsIgnoreCase(commit.committer.name) }.inject(builder) { bldr, commit -> bldr.append(' - ') bldr.append(commit.shortMessage) @@ -139,7 +146,9 @@ task changelog << { fileChangelog << builder.toString() } - grgit.commit(message: 'Updating changelog', amend: false) + if (!lastCommitByCI) { + grgit.commit(message: 'Updating changelog', amend: false) + } } task vagrantExport(type: Zip) { -- GitLab