Skip to content
Snippets Groups Projects
Commit a3e899c8 authored by Wayne Beaton's avatar Wayne Beaton
Browse files

Bail out when we hit an exception.

parent a738bda2
No related branches found
No related tags found
No related merge requests found
......@@ -120,8 +120,7 @@ public class InitialContributionReviewTaskFinder {
}
logger.info("Review created {}", existing.getWebUrl());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
throw new RuntimeException(e1);
}
......@@ -131,14 +130,16 @@ public class InitialContributionReviewTaskFinder {
try {
var linkExists = gitlab.getIssuesApi().getIssueLinksStream(InitialContributionProcess.getIPLabPath(), existing.getIid())
.filter(each -> each.getIid() == issue.getIid())
.filter(each -> each.getIid().equals(issue.getIid()))
.findAny()
.isPresent();
if (!linkExists) {
gitlab.getIssuesApi().createIssueLink(InitialContributionProcess.getEmoProjectPath(), existing.getIid(), InitialContributionProcess.getIPLabPath(), issue.getIid());
gitlab.getIssuesApi().createIssueLink(InitialContributionProcess.getIPLabPath(), existing.getIid(), InitialContributionProcess.getEmoProjectPath(), issue.getIid());
}
} catch (GitLabApiException e) {
// NOTE that the GitLab user must have privileges on both repositories
// for the link creation to work.
throw new RuntimeException(e);
}
}
......@@ -152,7 +153,7 @@ public class InitialContributionReviewTaskFinder {
try {
IssueFilter filter = new IssueFilter().withLabels(Arrays.asList(new String[]{"Project Content","Initial Contribution"}));
return gitlab.getIssuesApi()
.getIssuesStream(InitialContributionProcess.getEmoProjectPath(), filter)
.getIssuesStream(InitialContributionProcess.getIPLabPath(), filter)
.filter(issue -> issue.getTitle().startsWith(match))
.findAny().orElse(null);
} catch (GitLabApiException e) {
......@@ -179,6 +180,9 @@ public class InitialContributionReviewTaskFinder {
.replace("{name}", repo.getFullName())
.replace("{sha}", sha);
var license = repo.getLicense();
var licenseName = license != null? license.getName() : "N/A";
var builder = new StringBuilder();
return builder
.append("Project: ").append(getProjectLink(project)).append("\n\n")
......@@ -187,7 +191,7 @@ public class InitialContributionReviewTaskFinder {
.append("[Repository]({url})\n\n".replace("{url}", repo.getHtmlUrl().toString()))
.append(" - Default branch: {branch}\n".replace("{branch}", repo.getDefaultBranch()))
.append(" - Commit: {sha}\n".replace("{sha}", sha))
.append(" - License: {license}\n".replace("{license}", repo.getLicense().getName()))
.append(" - License: {license}\n".replace("{license}", licenseName))
.append(" - [Browse]({url})\n".replace("{url}", browseUrl))
.append(" - [Source]({url})\n".replace("{url}", archiveUrl))
.toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment