use of org.kohsuke.github.GHIssue in project Rubicon by Rubicon-Bot.
the class CommandGitBug method handle.
public static void handle(MessageReceivedEvent event) {
if (!reportMap.containsKey(event.getAuthor().getIdLong())) {
return;
}
ReportHolder reportHolder = reportMap.get(event.getAuthor().getIdLong());
if (event.getMessage().getContentDisplay().contains(reportHolder.title))
return;
if (!event.getTextChannel().getId().equals(reportHolder.textChannel.getId()))
return;
String description = event.getMessage().getContentDisplay();
try {
GitHub gitHub = GitHub.connectUsingOAuth(Info.GITHUB_TOKEN);
GHRepository repository = gitHub.getOrganization("Rubicon-Bot").getRepository("Rubicon");
GHIssue issue = repository.createIssue(reportHolder.title).body(ISSUE_HEADER + event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator() + ISSUE_SUFFIX + description).label("Bug").label("Requires Testing").create();
reportHolder.delete(issue.getHtmlUrl().toString());
event.getMessage().delete().queue();
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.kohsuke.github.GHIssue in project contribution by checkstyle.
the class TemplateProcessorTest method getMockReleasenotesMessages.
private static List<ReleaseNotesMessage> getMockReleasenotesMessages() throws NoSuchFieldException, IllegalAccessException {
final List<ReleaseNotesMessage> messages = new ArrayList<>();
final ReleaseNotesMessage msgWithoutIssueNo = new ReleaseNotesMessage("Mock issue title 1", "Author 1");
messages.add(msgWithoutIssueNo);
final ReleaseNotesMessage msgWithoutIssueNoWithMultipleAuthors = new ReleaseNotesMessage("Mock issue title 2", "Author 3, Author 4");
messages.add(msgWithoutIssueNoWithMultipleAuthors);
final GHIssue issue1 = getMockGithubIssue(123, "Mock issue title 3");
final ReleaseNotesMessage msgWithIssueNo = new ReleaseNotesMessage(issue1, "Author 5");
messages.add(msgWithIssueNo);
final GHIssue issue2 = getMockGithubIssue(123, "Mock issue title 4");
final ReleaseNotesMessage msgWithIssueNoWithMultipleAuthors = new ReleaseNotesMessage(issue2, "Author 6, Author 7");
messages.add(msgWithIssueNoWithMultipleAuthors);
return messages;
}
Aggregations