Skip to content
Permalink
Browse files
467: git pr create assumes .jcheck/conf file
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Aug 6, 2020
1 parent 5bf7aac commit 68d7387adee14cebf7a803b7cec384244447e780
Showing 1 changed file with 14 additions and 2 deletions.
@@ -227,12 +227,20 @@ static List<String> issuesFromPullRequest(PullRequest pr) {
return issues;
}

static String jbsProjectFromJcheckConf(Repository repo, String targetBranch) throws IOException {
static Optional<String> jbsProjectFromJcheckConf(Repository repo, String targetBranch) throws IOException {
var conf = JCheckConfiguration.from(repo, repo.resolve(targetBranch).orElseThrow(() ->
new IOException("Could not resolve '" + targetBranch + "' branch")
));

return conf.get().general().jbs();
if (conf.isEmpty()) {
return Optional.empty();
}

return Optional.ofNullable(conf.get().general().jbs());
}

static Optional<Issue> getIssue(Commit commit, Optional<String> project) throws IOException {
return project.isEmpty() ? Optional.empty() : getIssue(commit, project.get());
}

static Optional<Issue> getIssue(Commit commit, String project) throws IOException {
@@ -247,6 +255,10 @@ static Optional<Issue> getIssue(Commit commit, String project) throws IOExceptio
return Optional.empty();
}

static Optional<Issue> getIssue(Branch b, Optional<String> project) throws IOException {
return project.isEmpty() ? Optional.empty() : getIssue(b, project.get());
}

static Optional<Issue> getIssue(Branch b, String project) throws IOException {
return getIssue(b.name(), project);
}

1 comment on commit 68d7387

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 68d7387 Aug 6, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.