run task only if pull request opened
@@ -305,6 +305,7 @@ public class UpgradeDependencyPlugin implements Plugin<Project> {
});
}
+ task.onlyIf(isPullRequestOpen(task));
task.onlyIf(wasBuildFileUpdatedSpec(replaceVersionTask));
}
});
@@ -362,6 +363,15 @@ public class UpgradeDependencyPlugin implements Plugin<Project> {
};
}
+ private Spec<Task> isPullRequestOpen(final MergePullRequestTask mergePullRequestTask) {
+ return new Spec<Task>() {
+ @Override
+ public boolean isSatisfiedBy(Task element) {
+ return mergePullRequestTask.getPullRequestSha() != null && mergePullRequestTask.getPullRequestUrl() != null;
+ }
+ };
+ }
+
private Spec<Task> wasOpenPullRequestNotFound(final FindOpenPullRequestTask findOpenPullRequestTask) {
return new Spec<Task>() {
@Override
