/** * 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; }
/** * 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; }
/** * Returns actual title of issue or pull request which is represented as an issue. * @param issue issue object. * @return actual title of issue or pull request which is represented as an issue. */ private static String getActualTitle(GHIssue issue) { final String actualTitle; final String issueTitle = issue.getTitle(); if (issueTitle.startsWith("Pull")) { actualTitle = issueTitle.substring(issueTitle.indexOf(':') + 2); } else { actualTitle = issueTitle; } return split(actualTitle); }
/** * Checks for skip build phrase in pull request title and body. If present it updates shouldRun as false. * * @param issue The GitHub issue * @return the skip phrase or null if should not skip */ public String checkSkipBuildPhrase(GHIssue issue) { Set<String> skipBuildPhrases = getSkipBuildPhrases(); skipBuildPhrases.remove(""); Map<Pattern, String> skipPatterns = new HashMap<Pattern, String>(); for (String skipBuildPhrase : skipBuildPhrases) { skipBuildPhrase = skipBuildPhrase.trim(); skipPatterns.put(compilePattern(skipBuildPhrase), skipBuildPhrase); } // check in title String pullRequestTitle = issue.getTitle(); String skipBuildPhrase = checkSkipBuildInString(skipPatterns, pullRequestTitle); if (StringUtils.isNotBlank(skipBuildPhrase)) { return skipBuildPhrase; } // not found in title, check in body String pullRequestBody = issue.getBody(); skipBuildPhrase = checkSkipBuildInString(skipPatterns, pullRequestBody); if (StringUtils.isNotBlank(skipBuildPhrase)) { return skipBuildPhrase; } return null; }
if (issue.getState() != GHIssueState.CLOSED) { result.addWarning(String.format("[WARN] Issue #%d \"%s\" is not closed!", issueNo, issue.getTitle()));