Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Initial code for improving automated commit message
Browse files Browse the repository at this point in the history
- TravisPlugin updates the commit message postfix and can include build url.
- See issue #513 for details
  • Loading branch information
mockitoguy committed Oct 18, 2017
1 parent c9d52f4 commit 34eddcb
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.shipkit.gradle.configuration.ShipkitConfiguration;
import org.shipkit.gradle.git.GitCommitTask;
import org.shipkit.gradle.git.IdentifyGitBranchTask;
import org.shipkit.gradle.release.ReleaseNeededTask;
import org.shipkit.internal.gradle.configuration.BasicValidator;
import org.shipkit.internal.gradle.configuration.LazyConfiguration;
import org.shipkit.internal.gradle.configuration.ShipkitConfigurationPlugin;
import org.shipkit.internal.gradle.git.GitBranchPlugin;
import org.shipkit.internal.gradle.git.GitPlugin;
import org.shipkit.internal.gradle.git.GitSetupPlugin;
import org.shipkit.internal.gradle.git.tasks.GitCheckOutTask;
import org.shipkit.internal.gradle.util.StringUtil;
Expand Down Expand Up @@ -39,6 +43,7 @@ public class TravisPlugin implements Plugin<Project> {
@Override
public void apply(final Project project) {
project.getPlugins().apply(CiReleasePlugin.class);
ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();

final String branch = System.getenv("TRAVIS_BRANCH");
LOG.info("Branch from 'TRAVIS_BRANCH' env variable: {}", branch);
Expand Down Expand Up @@ -74,5 +79,12 @@ public void execute(ReleaseNeededTask t) {
t.setPullRequest(isPullRequest);
}
});

GitCommitTask gitCommit = (GitCommitTask) project.getTasks().getByName(GitPlugin.GIT_COMMIT_TASK);
//can we construct the url from some Travis env variable?
//this needs to be safe for local invocation where there are no travis env variables.
String travisJobUrl = "https://travis-ci.org/mockito/shipkit/builds/288214072";
String postfix = ". CI job: " + travisJobUrl + " " + conf.getGit().getCommitMessagePostfix();
gitCommit.setCommitMessagePostfix(postfix);
}
}

0 comments on commit 34eddcb

Please sign in to comment.