本文整理汇总了Java中org.kohsuke.github.GHIssue类的典型用法代码示例。如果您正苦于以下问题:Java GHIssue类的具体用法?Java GHIssue怎么用?Java GHIssue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GHIssue类属于org.kohsuke.github包,在下文中一共展示了GHIssue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
@Nonnull TaskListener listener) throws InterruptedException, IOException {
if (getStatusVerifier() != null && !getStatusVerifier().isRunAllowed(run)) {
return;
}
try {
HashSet<String> remoteLabels = new HashSet<>();
final GHIssue ghIssue = getGhIssue(run);
//remote labels List -> Set
ghIssue.getLabels().stream()
.map(GHLabel::getName)
.collect(Collectors.toList())
.forEach(remoteLabels::add);
remoteLabels.addAll(getLabelProperty().getLabelsSet());
ghIssue.setLabels(remoteLabels.toArray(new String[remoteLabels.size()]));
} catch (IOException ex) {
final int number = getPRNumberFromPRCause(run);
listener.getLogger().println("Couldn't add label for PR #" + number + ex.getMessage());
LOGGER.error("Couldn't add label for PR #{}", number, ex);
handlePublisherError(run);
}
}
示例2: getMockReleasenotesMessages
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
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;
}
示例3: syncIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
private static boolean syncIssue(final GHRepository rep, final int issueId, final String body) {
try {
GHIssue issue = rep.getIssue(issueId);
issue.setBody(body);
return true;
}
catch (Exception e) {
e.printStackTrace();
}
return false;
}
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:13,代码来源:SyncDocsToGithubSubCommand.java
示例4: getOrFindIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
protected GHIssue getOrFindIssue(CommandContext context, GHRepository ghRepository) throws IOException {
GHIssue issue = context.getIssue();
if (issue == null) {
List<GHIssue> issues = Issues.getOpenIssues(ghRepository, context.getConfiguration());
issue = Issues.findIssue(context, issues);
context.setIssue(issue);
}
return issue;
}
示例5: updatePendingChanges
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public void updatePendingChanges(CommandContext context, DependenciesCheck check, List<DependencyVersionChange> pendingChanges) throws IOException {
Configuration configuration = context.getConfiguration();
List<DependencyVersionChange> currentPendingChanges = check.getInvalidChanges();
GHRepository ghRepository = context.gitHubRepository();
if (ghRepository != null) {
GHIssue issue = getOrFindIssue(context, ghRepository);
if (currentPendingChanges.equals(pendingChanges)) {
if (issue != null) {
LOG.debug("Pending changes unchanged so not modifying the issue");
}
return;
}
String operationDescrption = getOperationDescription(context);
if (currentPendingChanges.isEmpty()) {
if (issue != null) {
context.info(LOG, "Closing issue as we have no further pending issues " + issue.getHtmlUrl());
issue.comment(Issues.CLOSE_MESSAGE + operationDescrption);
issue.close();
}
return;
}
if (issue == null) {
issue = Issues.createIssue(context, ghRepository);
context.setIssue(issue);
context.info(LOG, configuration.colored(Configuration.COLOR_PENDING, "Created issue " + issue.getHtmlUrl()));
} else {
context.info(LOG, configuration.colored(Configuration.COLOR_PENDING, "Modifying issue " + issue.getHtmlUrl()));
}
Issues.addConflictsComment(issue, currentPendingChanges, operationDescrption, check);
} else {
// TODO what to do with vanilla git repos?
}
}
示例6: loadPendingChanges
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
protected List<DependencyVersionChange> loadPendingChanges(CommandContext context) throws IOException {
GHRepository ghRepository = context.gitHubRepository();
if (ghRepository != null) {
List<GHIssue> issues = Issues.getOpenIssues(ghRepository, context.getConfiguration());
GHIssue issue = Issues.findIssue(context, issues);
if (issue != null) {
context.setIssue(issue);
return Issues.loadPendingChangesFromIssue(context, issue);
}
} else {
// TODO what to do with vanilla git repos?
}
return new ArrayList<>();
}
示例7: getIssues
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public List<GHIssue> getIssues() {
List<GHIssue> answer = new ArrayList<>();
for (CommandContext child : children) {
GHIssue issue = child.getIssue();
if (issue != null) {
answer.add(issue);
}
}
return answer;
}
示例8: StatusInfo
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public StatusInfo(LocalRepository repository, Status status, GHIssue issue, GHPullRequest pullRequest) {
this.repository = repository;
this.issue = issue;
this.pullRequest = pullRequest;
this.issueUrl = (issue != null) ? Strings.toString(issue.getHtmlUrl()) : null;
this.pullRequestUrl = (pullRequest != null) ? Strings.toString(pullRequest.getHtmlUrl()) : null;
this.cloneUrl = repository.getCloneUrl();
this.issueState = state(issue);
this.pullRequestState = state(pullRequest);
if (nullOrClosed(issueState) && nullOrClosed(pullRequestState) && status.equals(Status.PENDING)) {
status = Status.COMPLETE;
}
this.status = status;
}
示例9: getOpenIssues
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public static List<GHIssue> getOpenIssues(GHRepository ghRepository, String label) throws IOException {
List<GHIssue> issues = retryGithub(() -> ghRepository.getIssues(GHIssueState.OPEN));
List<GHIssue> answer = new ArrayList<>();
for (GHIssue issue : issues) {
if (GitHubHelpers.hasLabel(getLabels(issue), label) && !issue.isPullRequest()) {
answer.add(issue);
}
}
return answer;
}
示例10: loadPendingChangesFromIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public static List<DependencyVersionChange> loadPendingChangesFromIssue(CommandContext context, GHIssue issue) throws IOException {
List<GHIssueComment> comments = issue.getComments();
String lastCommand = null;
for (GHIssueComment comment : comments) {
String command = updateBotIssuePendingChangesComment(context, comment);
if (command != null) {
lastCommand = command;
}
}
if (lastCommand == null) {
LOG.warn("No UpdateBot comment found on issue " + issue.getHtmlUrl());
return new ArrayList<>();
}
return parseUpdateBotIssuePendingChangesComment(lastCommand);
}
示例11: findIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
/**
* Lets try find the issue
*/
public static GHIssue findIssue(CommandContext context, List<GHIssue> issues) {
String prefix = context.createIssueTitlePrefix();
if (issues != null) {
for (GHIssue issue : issues) {
String title = issue.getTitle();
if (title != null && title.startsWith(prefix)) {
return issue;
}
}
}
return null;
}
示例12: isOpen
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public static boolean isOpen(GHIssue issue) {
GHIssueState state = issue.getState();
if (state == null) {
return true;
}
return state == GHIssueState.OPEN;
}
示例13: assertOpenIssueAndPullRequestCount
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public void assertOpenIssueAndPullRequestCount(String repoName, int expectedIssueCount, int exepectedPullRequestCount, boolean verbose) throws IOException {
LocalRepository repository = assertLocalRepository(repoName);
GHRepository gitHubRepository = GitHubHelpers.getGitHubRepository(repository);
assertThat(gitHubRepository).describedAs("Not a GitHub repository " + repository).isNotNull();
String label = configuration.getGithubPullRequestLabel();
List<GHIssue> issues;
List<GHPullRequest> prs;
boolean doAssert = true;
if (doAssert) {
issues = GithubAssertions.assertOpenIssueCount(gitHubRepository, label, expectedIssueCount);
prs = GithubAssertions.assertOpenPullRequestCount(gitHubRepository, label, exepectedPullRequestCount);
} else {
issues = Issues.getOpenIssues(gitHubRepository, configuration);
prs = PullRequests.getOpenPullRequests(gitHubRepository, configuration);
}
if (verbose) {
LOG.warn("===> " + gitHubRepository.getName() + " Issue count: " + issues.size() + " PR count: " + prs.size());
Issues.logOpen(issues);
PullRequests.logOpen(prs);
}
}
示例14: removeGHIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public static void removeGHIssue(GHRepository repo, String user, int issueID)
throws IOException {
GHIssue issue = repo.getIssue(issueID);
if (isSlackIssue(issue)) {
issue.comment("Closed by " + user);
issue.close();
}
}
示例15: isSlackIssue
import org.kohsuke.github.GHIssue; //导入依赖的package包/类
public static boolean isSlackIssue(GHIssue issue) throws IOException {
for (GHLabel label : issue.getLabels()) {
for (String slackLabel : getSlackLabels()) {
if (label.getName().equalsIgnoreCase(slackLabel)) {
return true;
}
}
}
return false;
}