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

Initial code for improving automated commit message #514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. Should it be project specific? PowerMock or Mockito should rather have some other Travis links.

I haven't check it, but couldn't TRAVIS_BUILD_ID be used here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't check it, but couldn't TRAVIS_BUILD_ID be used here?

Yes, that's the idea! We won't be hardcoding any url here!

String postfix = ". CI job: " + travisJobUrl + " " + conf.getGit().getCommitMessagePostfix();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit will be too long. It would be better to have extra information available in the second (and the following) lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably also with the information about the release notes generation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

gitCommit.setCommitMessagePostfix(postfix);
}
}