Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

467: git pr create assumes .jcheck/conf file #711

Closed
wants to merge 1 commit into from
Closed
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
@@ -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);
}