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

Update notifier PR matching pattern #145

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
@@ -52,6 +52,7 @@ private static String replyFooter(PullRequestInstance prInstance) {
return "PR: " + prInstance.pr().getWebUrl();
}

// When changing this, ensure that the PR pattern in the notifier still matches
static String composeConversation(PullRequestInstance prInstance, URI webrev) {
var commitMessages = prInstance.formatCommitMessages(prInstance.baseHash(), prInstance.headHash(), ArchiveMessages::formatCommit);
var filteredBody = filterComments(prInstance.pr().getBody());
@@ -131,7 +131,7 @@ private List<Commit> filterAndSendPrCommits(HostedRepository repository, List<Co

var candidate = candidates.get(0);
var prLink = candidate.getWebUrl();
var prLinkPattern = Pattern.compile("^" + Pattern.quote(prLink.toString()), Pattern.MULTILINE);
var prLinkPattern = Pattern.compile("^(?:PR: )?" + Pattern.quote(prLink.toString()), Pattern.MULTILINE);

var rfrCandidates = rfrs.stream()
.filter(email -> prLinkPattern.matcher(email.body()).find())
@@ -398,7 +398,7 @@ void testMailingListPROnly(TestInfo testInfo) throws IOException {
assertThrows(RuntimeException.class, () -> listServer.processIncoming(Duration.ofMillis(1)));

// Simulate an RFR email
var rfr = Email.create(sender, "RFR: My PR", "PR:\n" + pr.getWebUrl().toString())
var rfr = Email.create(sender, "RFR: My PR", "PR: " + pr.getWebUrl().toString())
.recipient(listAddress)
.build();
mailmanList.post(rfr);