From 28d0bb7ed03c72912e37fe4319707595be1b179f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 Dec 2024 16:42:40 +0100 Subject: [PATCH] Include pull requests in the lottery for the triage/stale/stewardship categories --- README.adoc | 78 +++++++++---------- .../quarkus/github/lottery/draw/Lottery.java | 6 +- .../lottery/github/GitHubRepository.java | 24 +++--- .../MessageFormatter/notificationBody.md | 6 +- .../github/lottery/GitHubServiceTest.java | 21 +++-- .../lottery/LotterySingleRepositoryTest.java | 27 ++++--- .../github/lottery/MessageFormatterTest.java | 12 +-- 7 files changed, 91 insertions(+), 83 deletions(-) diff --git a/README.adoc b/README.adoc index e559ff3..aeca79d 100644 --- a/README.adoc +++ b/README.adoc @@ -1,13 +1,13 @@ = Quarkus GitHub Lottery -> A Quarkus-powered GitHub App that regularly sends short lists of GitHub issues for triagers/maintainers/stewards to consider. +> A Quarkus-powered GitHub App that regularly sends short lists of GitHub issues/PRs for triagers/maintainers/stewards to consider. [[intro]] == Introduction This GitHub App is based on the https://github.com/quarkiverse/quarkus-github-app[Quarkus GitHub App framework]. -It periodically extracts GitHub issues from one "source" GitHub repository (e.g. https://github.com/quarkusio/quarkus) +It periodically extracts GitHub issues/PRs from one "source" GitHub repository (e.g. https://github.com/quarkusio/quarkus) and notifies maintainers about them by commenting on GitHub issues in another "notification" GitHub repository (e.g. https://github.com/quarkusio/quarkus-github-lottery-reports). That second "notification" repository <>, @@ -20,10 +20,10 @@ each time its sends a notification. That way, maintainers will get daily (or weekly) reports via email, sent by GitHub when the comment is added. -Issues are randomly assigned among eligible maintainers up to a limit they define themselves, +Issues/PRs are randomly assigned among eligible maintainers up to a limit they define themselves, so that everyone gets a chance to help according to the time they want to invest. -There are multiple categories of issues that one can be notified about; +There are multiple categories of issues/PRs that one can be notified about; see <> for more information, but here's what an email notification may look like: image::documentation/screenshots/notification.png[Example of an email notification,align="center"] @@ -35,7 +35,7 @@ image::documentation/screenshots/notification.png[Example of an email notificati === Basics As a Quarkus triager, a Quarkus core/extension maintainer, or a Quarkus steward, -in order to get notifications about Quarkus issues on GitHub: +in order to get notifications about Quarkus issues/PRs on GitHub: * Make sure you have access to the https://github.com/quarkusio/quarkus-github-lottery-reports["notification" repository] if not, request access to an admin of the https://github.com/quarkusio[quarkusio] organization. @@ -98,7 +98,7 @@ See below for details about each section. [[participants-triage]] === Triage -If the `triage` section is present, you will get notified about issues that haven't been assigned an area yet. +If the `triage` section is present, you will get notified about Issues/PRs that haven't been assigned an area yet. Please add an area label, remove the "needs triage" (e.g. `triage/needs-triage`) label, and ping the relevant maintainers if necessary. @@ -123,7 +123,7 @@ On which days you wish to get notified about triage. + Array of ``WeekDay``s, mandatory, no default. `maxIssues`:: -How many issues, at most, you wish to be included in the "triage" category +How many issues/PRs, at most, you wish to be included in the "triage" category for each notification. + Integer, mandatory, no default. @@ -131,11 +131,11 @@ Integer, mandatory, no default. [[participants-maintenance]] === Maintenance -If the `maintenance` section is present, you will get notified about issues +If the `maintenance` section is present, you will get notified about issues/PRs related to a specific area (e.g. `area/hibernate-orm`) that may be stalled and require intervention from maintainers or reporters. -Issues in "maintenance" notifications will be split in three categories: +Issues/PRs in "maintenance" notifications will be split in three categories: Feedback Needed:: Issues with missing reproducer/information. @@ -146,13 +146,13 @@ Issues with newly provided reproducer/information. + Please have a closer look, possibly remove the "needs feedback" (e.g. `triage/needs-reproducer`) label, and plan further work. Stale:: -Issues last updated a long time ago. +Issues or PRs last updated a long time ago. + -Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... +Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... Of course, in every situation, simply continuing the conversation, pinging someone, or even doing nothing at all are perfectly acceptable responses: -it's all up to you, and issues that don't change will reappear in another notification, a few days later. +it's all up to you, and issues/PRs that don't change will reappear in another notification, a few days later. The `maintenance` section will look like this: @@ -174,8 +174,8 @@ participants: ---- `labels`:: -The labels identifying issues you are interested in, as a maintainer. -Issues mentioned in notifications will have at least one of these labels. +The labels identifying issues/PRs you are interested in, as a maintainer. +Issues/PRs mentioned in notifications will have at least one of these labels. + Array of Strings, mandatory, no default. `days`:: @@ -183,17 +183,17 @@ On which days you wish to get notified about maintenance. + Array of ``WeekDay``s, mandatory, no default. `feedback.needed.maxIssues`:: -How many issues, at most, you wish to be included in the "Feedback needed" category +How many issues/PRs, at most, you wish to be included in the "Feedback needed" category for each notification. + Integer, mandatory, no default. `feedback.provided.maxIssues`:: -How many issues, at most, you wish to be included in the "Feedback provided" category +How many issues/PRs, at most, you wish to be included in the "Feedback provided" category for each notification. + Integer, mandatory, no default. `stale.maxIssues`:: -How many issues, at most, you wish to be included in the "Stale" category +How many issues/PRs, at most, you wish to be included in the "Stale" category for each notification. + Integer, mandatory, no default. @@ -202,17 +202,17 @@ Integer, mandatory, no default. === Stewardship IMPORTANT: This section should only be of interest to stewards: -core contributors who spend significant time working on GitHub issues. +core contributors who spend significant time working on GitHub issues/PRs. If you don't already know what this section is about, you probably don't want to use it. -If the `stewardship` section is present, you will get notified about Issues across all areas last updated a long time ago. +If the `stewardship` section is present, you will get notified about issues or PRs across all areas last updated a long time ago. -Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... +Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... NOTE: Notifications to stewards are sent independently of notifications to maintainers, so that the work of maintainers won't be affected by the work of stewards. -It is entirely possible for a maintainer to be notified about an issue +It is entirely possible for a maintainer to be notified about an issue/PR at the same time as a steward. The `stewardship` section will look like this: @@ -232,7 +232,7 @@ On which days you wish to get notified about stewardship. + Array of ``WeekDay``s, mandatory, no default. `maxIssues`:: -How many issues, at most, you wish to be included in the "stewardship" category +How many issues/PRs, at most, you wish to be included in the "stewardship" category for each notification. + Integer, mandatory, no default. @@ -253,7 +253,7 @@ See the footnote in the notifications you receive. Here is a link to the application on GitHub: https://github.com/apps/quarkus-github-lottery -The application needs to be installed on both the "source" repository (the one issues are extracted from) +The application needs to be installed on both the "source" repository (the one issues/PRs are extracted from) and the "notification" repository (the one "notification" issues are added to). IMPORTANT: For security reasons, @@ -266,11 +266,11 @@ The "notification" repository should ideally be private: * This repository is only about notifying maintainers, so it does not provide any useful information to anyone else. * Making the "notification" repository public would lead to publicly visible references to notifications -in the history of "source" issues, like this: +in the history of "source" issues/PRs, like this: + -image::documentation/screenshots/notification-reference.png[Example of references to notifications in the GitHub issue history,align="center"] +image::documentation/screenshots/notification-reference.png[Example of references to notifications in the GitHub issue/PR history,align="center"] + -Those add clutter to the history, and might create false hopes in issue reporters +Those add clutter to the history, and might create false hopes in issue/PR submitters ("someone is actively addressing my issue!"). ==== @@ -315,16 +315,16 @@ The full name of the GitHub repository where "reports"/"notification issues" wil + String, mandatory, no default. `buckets.triage.label`:: -The label identifying GitHub issues that require triage. +The label identifying GitHub issues/PRs that require triage. + String, mandatory, no default. `buckets.triage.delay`:: -How much time to wait after the last update on an issue +How much time to wait after the last update on an issue/PR before including it in the lottery in the "triage" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.triage.timeout`:: -How much time to wait after an issue was last notified about +How much time to wait after an issue/PR was last notified about before including it again in the lottery in the "triage" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. @@ -353,33 +353,33 @@ before including it again in the lottery in the "feedback provided" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.maintenance.stale.delay`:: -How much time to wait after the last update on an issue +How much time to wait after the last update on an issue/PR before including it in the lottery in the "stale" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.maintenance.stale.ignoreLabels`:: -The labels identifying GitHub issues that should be ignored for the "stale" bucket. -Issues with one of these labels will never be added to the bucket. +The labels identifying GitHub issues/PRs that should be ignored for the "stale" bucket. +Issues/PRs with one of these labels will never be added to the bucket. + Array of Strings, optional, defaults to an empty array. `buckets.maintenance.stale.timeout`:: -How much time to wait after an issue was last notified about +How much time to wait after an issue/PR was last notified about before including it again in the lottery in the "stale" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.stewardship.delay`:: -How much time to wait after the last update on an issue +How much time to wait after the last update on an issue/PR before including it in the lottery in the "stewardship" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.stewardship.timeout`:: -How much time to wait after an issue was last notified about +How much time to wait after an issue/PR was last notified about before including it again in the lottery in the "stewardship" bucket. + String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default. `buckets.stewardship.ignoreLabels`:: -The labels identifying GitHub issues that should be ignored for the "stewardship" bucket. -Issues with one of these labels will never be added to the bucket. +The labels identifying GitHub issues/PRs that should be ignored for the "stewardship" bucket. +Issues/PRs with one of these labels will never be added to the bucket. + Array of Strings, optional, defaults to an empty array. @@ -413,8 +413,8 @@ follow the steps outlined in https://quarkiverse.github.io/quarkiverse-docs/quar When registering your app, request the following Repository permissions: * Checks - `Read & Write`: to <>. -* Issues - `Read & Write`: to list issues that should be notified, and create "notification" issues in another repository. -* Pull Requests - `Read & Write`: to react to <>. +* Issues - `Read & Write`: to list issues that should be notified, and to create "notification" issues in another repository. +* Pull Requests - `Read & Write`: to list PRs that should be notified, and to react to <>. And subscribe to the following events: diff --git a/src/main/java/io/quarkus/github/lottery/draw/Lottery.java b/src/main/java/io/quarkus/github/lottery/draw/Lottery.java index b5c6e78..c15a96e 100644 --- a/src/main/java/io/quarkus/github/lottery/draw/Lottery.java +++ b/src/main/java/io/quarkus/github/lottery/draw/Lottery.java @@ -95,7 +95,7 @@ void createDraws(GitHubRepository repo, LotteryHistory lotteryHistory, List history.lastNotificationTimedOutForIssueNumber(issue.number())) .iterator(), allWinnings)); @@ -159,7 +159,7 @@ void createDraws(GitHubRepository repo, LotteryHistory lotteryHistory, List(config.maintenance().stale().ignoreLabels()); var history = lotteryHistory.stale(); draws.add(stale.createDraw( - repo.issuesWithLabelLastUpdatedBefore(areaLabel, ignoreLabels, cutoff) + repo.issuesOrPullRequestsWithLabelLastUpdatedBefore(areaLabel, ignoreLabels, cutoff) .filter(issue -> history.lastNotificationTimedOutForIssueNumber(issue.number())) .iterator(), allWinnings)); @@ -181,7 +181,7 @@ void createDraws(GitHubRepository repo, LotteryHistory lotteryHistory, List(config.stewardship().ignoreLabels()); var history = lotteryHistory.stewardship(); draws.add(bucket.createDraw( - repo.issuesLastUpdatedBefore(ignoreLabels, cutoff) + repo.issuesOrPullRequestsLastUpdatedBefore(ignoreLabels, cutoff) .filter(issue -> history.lastNotificationTimedOutForIssueNumber(issue.number())) .iterator(), allWinnings)); diff --git a/src/main/java/io/quarkus/github/lottery/github/GitHubRepository.java b/src/main/java/io/quarkus/github/lottery/github/GitHubRepository.java index ab0c45a..167f77f 100644 --- a/src/main/java/io/quarkus/github/lottery/github/GitHubRepository.java +++ b/src/main/java/io/quarkus/github/lottery/github/GitHubRepository.java @@ -101,12 +101,17 @@ private GHRepository repository() throws IOException { return repository; } - private GHIssueSearchBuilder searchIssues() { + private GHIssueSearchBuilder searchIssuesOnly() { return client().searchIssues() .q(repo(ref)) .q(isIssue()); } + private GHIssueSearchBuilder searchIssuesOrPullRequests() { + return client().searchIssues() + .q(repo(ref)); + } + private DynamicGraphQLClient graphQLClient() { if (graphQLClient == null) { graphQLClient = clientProvider.getInstallationGraphQLClient(ref.installationRef().installationId()); @@ -120,15 +125,15 @@ public Optional fetchLotteryConfig() throws IOException { } /** - * Lists issues that were last updated before the given instant. + * Lists issues or pull requests that were last updated before the given instant. * * @param ignoreLabels GitHub labels. Issues assigned with any of these labels are ignored (not returned). * @param updatedBefore An instant; all returned issues must have been last updated before that instant. * @return A lazily populated stream of matching issues. * @throws java.io.UncheckedIOException In case of I/O failure. */ - public Stream issuesLastUpdatedBefore(Set ignoreLabels, Instant updatedBefore) { - var builder = searchIssues() + public Stream issuesOrPullRequestsLastUpdatedBefore(Set ignoreLabels, Instant updatedBefore) { + var builder = searchIssuesOrPullRequests() .isOpen() .q(updatedBefore(updatedBefore)) .sort(GHIssueSearchBuilder.Sort.UPDATED) @@ -140,7 +145,7 @@ public Stream issuesLastUpdatedBefore(Set ignoreLabels, Instant u } /** - * Lists issues with the given label that were last updated before the given instant. + * Lists issues or pull requests with the given label that were last updated before the given instant. * * @param label A GitHub label; if non-null, all returned issues must have been assigned that label. * @param ignoreLabels GitHub labels. Issues assigned with any of these labels are ignored (not returned). @@ -148,8 +153,9 @@ public Stream issuesLastUpdatedBefore(Set ignoreLabels, Instant u * @return A lazily populated stream of matching issues. * @throws java.io.UncheckedIOException In case of I/O failure. */ - public Stream issuesWithLabelLastUpdatedBefore(String label, Set ignoreLabels, Instant updatedBefore) { - var builder = searchIssues() + public Stream issuesOrPullRequestsWithLabelLastUpdatedBefore(String label, Set ignoreLabels, + Instant updatedBefore) { + var builder = searchIssuesOrPullRequests() .isOpen() .q(label(label)) .q(updatedBefore(updatedBefore)) @@ -175,7 +181,7 @@ public Stream issuesWithLabelLastUpdatedBefore(String label, Set */ public Stream issuesLastActedOnByAndLastUpdatedBefore(Set initialActionLabels, String filterLabel, IssueActionSide lastActionSide, Instant updatedBefore) { - return toStream(searchIssues() + return toStream(searchIssuesOnly() .isOpen() .q(anyLabel(initialActionLabels)) .q(label(filterLabel)) @@ -318,7 +324,7 @@ public void update(String topicSuffix, String markdownBody, boolean comment) } private Stream getDedicatedIssues() throws IOException { - var builder = searchIssues() + var builder = searchIssuesOnly() .q(author(appLogin())); if (ref.assignee() != null) { builder.q(assignee(ref.assignee())); diff --git a/src/main/resources/templates/MessageFormatter/notificationBody.md b/src/main/resources/templates/MessageFormatter/notificationBody.md index 242a908..014ab07 100644 --- a/src/main/resources/templates/MessageFormatter/notificationBody.md +++ b/src/main/resources/templates/MessageFormatter/notificationBody.md @@ -8,7 +8,7 @@ Maintenance areas: {report.config.maintenanceLabels.asMarkdownLabel}. # Triage {#include MessageFormatter/notificationBodyBucketContent bucket=report.triage.get()} -Issues that haven't been assigned an area yet. Please add an area label, remove the {report.config.triageLabel.asMarkdownLabel} label, optionally ping maintainers. +Issues/PRs that haven't been assigned an area yet. Please add an area label, remove the {report.config.triageLabel.asMarkdownLabel} label, optionally ping maintainers. {/include} @@ -35,7 +35,7 @@ Maintenance areas: {report.config.maintenanceLabels.asMarkdownLabel}. # Stale {#include MessageFormatter/notificationBodyBucketContent bucket=report.stale.get()} -Issues last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... +Issues or PRs last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... {/include} @@ -44,7 +44,7 @@ Maintenance areas: {report.config.maintenanceLabels.asMarkdownLabel}. # Stewardship {#include MessageFormatter/notificationBodyBucketContent bucket=report.stewardship.get()} -Issues across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... +Issues or PRs across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... {/include} diff --git a/src/test/java/io/quarkus/github/lottery/GitHubServiceTest.java b/src/test/java/io/quarkus/github/lottery/GitHubServiceTest.java index 3a1488c..7929c69 100644 --- a/src/test/java/io/quarkus/github/lottery/GitHubServiceTest.java +++ b/src/test/java/io/quarkus/github/lottery/GitHubServiceTest.java @@ -362,7 +362,7 @@ void fetchLotteryConfig_minimal() throws IOException { } @Test - void issuesLastUpdatedBefore() throws IOException { + void issuesOrPullRequestsLastUpdatedBefore() throws IOException { var repoRef = new GitHubRepositoryRef(installationRef, "quarkusio/quarkus"); Instant now = LocalDateTime.of(2017, 11, 6, 6, 0).toInstant(ZoneOffset.UTC); @@ -385,12 +385,11 @@ void issuesLastUpdatedBefore() throws IOException { .when(() -> { var repo = gitHubService.repository(repoRef); - assertThat(repo.issuesLastUpdatedBefore(Set.of(), cutoff)) + assertThat(repo.issuesOrPullRequestsLastUpdatedBefore(Set.of(), cutoff)) .containsExactlyElementsOf(stubIssueList(1, 3, 2, 4)); }) .then().github(mocks -> { verify(searchIssuesBuilderMock).q("repo:" + repoRef.repositoryName()); - verify(searchIssuesBuilderMock).q("is:issue"); verify(searchIssuesBuilderMock).isOpen(); verify(searchIssuesBuilderMock).q("updated:<2017-11-05T06:00"); verify(searchIssuesBuilderMock).sort(GHIssueSearchBuilder.Sort.UPDATED); @@ -401,7 +400,7 @@ void issuesLastUpdatedBefore() throws IOException { } @Test - void issuesLastUpdatedBefore_ignoreLabels() throws IOException { + void issuesOrPullRequestsLastUpdatedBefore_ignoreLabels() throws IOException { var repoRef = new GitHubRepositoryRef(installationRef, "quarkusio/quarkus"); Instant now = LocalDateTime.of(2017, 11, 6, 6, 0).toInstant(ZoneOffset.UTC); @@ -424,12 +423,11 @@ void issuesLastUpdatedBefore_ignoreLabels() throws IOException { .when(() -> { var repo = gitHubService.repository(repoRef); - assertThat(repo.issuesLastUpdatedBefore(Set.of("triage/on-ice"), cutoff)) + assertThat(repo.issuesOrPullRequestsLastUpdatedBefore(Set.of("triage/on-ice"), cutoff)) .containsExactlyElementsOf(stubIssueList(1, 3, 2, 4)); }) .then().github(mocks -> { verify(searchIssuesBuilderMock).q("repo:" + repoRef.repositoryName()); - verify(searchIssuesBuilderMock).q("is:issue"); verify(searchIssuesBuilderMock).isOpen(); verify(searchIssuesBuilderMock).q("updated:<2017-11-05T06:00"); verify(searchIssuesBuilderMock).sort(GHIssueSearchBuilder.Sort.UPDATED); @@ -441,7 +439,7 @@ void issuesLastUpdatedBefore_ignoreLabels() throws IOException { } @Test - void issuesWithLabelLastUpdatedBefore() throws IOException { + void issuesOrPullRequestsWithLabelLastUpdatedBefore() throws IOException { var repoRef = new GitHubRepositoryRef(installationRef, "quarkusio/quarkus"); Instant now = LocalDateTime.of(2017, 11, 6, 6, 0).toInstant(ZoneOffset.UTC); @@ -464,12 +462,11 @@ void issuesWithLabelLastUpdatedBefore() throws IOException { .when(() -> { var repo = gitHubService.repository(repoRef); - assertThat(repo.issuesWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), cutoff)) + assertThat(repo.issuesOrPullRequestsWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), cutoff)) .containsExactlyElementsOf(stubIssueList(1, 3, 2, 4)); }) .then().github(mocks -> { verify(searchIssuesBuilderMock).q("repo:" + repoRef.repositoryName()); - verify(searchIssuesBuilderMock).q("is:issue"); verify(searchIssuesBuilderMock).isOpen(); verify(searchIssuesBuilderMock).sort(GHIssueSearchBuilder.Sort.UPDATED); verify(searchIssuesBuilderMock).order(GHDirection.DESC); @@ -481,7 +478,7 @@ void issuesWithLabelLastUpdatedBefore() throws IOException { } @Test - void issuesWithLabelLastUpdatedBefore_ignoreLabels() throws IOException { + void issuesOrPullRequestsWithLabelLastUpdatedBefore_ignoreLabels() throws IOException { var repoRef = new GitHubRepositoryRef(installationRef, "quarkusio/quarkus"); Instant now = LocalDateTime.of(2017, 11, 6, 6, 0).toInstant(ZoneOffset.UTC); @@ -504,12 +501,12 @@ void issuesWithLabelLastUpdatedBefore_ignoreLabels() throws IOException { .when(() -> { var repo = gitHubService.repository(repoRef); - assertThat(repo.issuesWithLabelLastUpdatedBefore("triage/needs-triage", Set.of("triage/on-ice"), cutoff)) + assertThat(repo.issuesOrPullRequestsWithLabelLastUpdatedBefore("triage/needs-triage", + Set.of("triage/on-ice"), cutoff)) .containsExactlyElementsOf(stubIssueList(1, 3, 2, 4)); }) .then().github(mocks -> { verify(searchIssuesBuilderMock).q("repo:" + repoRef.repositoryName()); - verify(searchIssuesBuilderMock).q("is:issue"); verify(searchIssuesBuilderMock).isOpen(); verify(searchIssuesBuilderMock).sort(GHIssueSearchBuilder.Sort.UPDATED); verify(searchIssuesBuilderMock).order(GHDirection.DESC); diff --git a/src/test/java/io/quarkus/github/lottery/LotterySingleRepositoryTest.java b/src/test/java/io/quarkus/github/lottery/LotterySingleRepositoryTest.java index b698711..2eb8f4f 100644 --- a/src/test/java/io/quarkus/github/lottery/LotterySingleRepositoryTest.java +++ b/src/test/java/io/quarkus/github/lottery/LotterySingleRepositoryTest.java @@ -289,7 +289,7 @@ void triage() throws IOException { Optional.empty()))); when(repoMock.fetchLotteryConfig()).thenReturn(Optional.of(config)); - when(repoMock.issuesWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) .thenAnswer(ignored -> stubIssueList(1, 3, 2, 4).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); @@ -328,7 +328,7 @@ void triage_issueAlreadyHasNonTimedOutNotification() throws IOException { Optional.empty()))); when(repoMock.fetchLotteryConfig()).thenReturn(Optional.of(config)); - when(repoMock.issuesWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) .thenAnswer(ignored -> stubIssueList(1, 3, 2, 4).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); @@ -382,7 +382,8 @@ void maintenance() throws IOException { Set.of("triage/needs-reproducer", "triage/needs-feedback"), "area/hibernate-orm", IssueActionSide.OUTSIDER, feedbackProvidedCutoff)) .thenAnswer(ignored -> stubIssueList(201, 202, 203).stream()); - when(repoMock.issuesWithLabelLastUpdatedBefore("area/hibernate-orm", Set.of("triage/on-ice"), staleCutoff)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("area/hibernate-orm", Set.of("triage/on-ice"), + staleCutoff)) .thenAnswer(ignored -> stubIssueList(301, 302, 303, 304, 305, 306).stream()); when(repoMock.issuesLastActedOnByAndLastUpdatedBefore( @@ -393,7 +394,8 @@ void maintenance() throws IOException { Set.of("triage/needs-reproducer", "triage/needs-feedback"), "area/hibernate-search", IssueActionSide.OUTSIDER, feedbackProvidedCutoff)) .thenAnswer(ignored -> stubIssueList(501, 502, 503).stream()); - when(repoMock.issuesWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), staleCutoff)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), + staleCutoff)) .thenAnswer(ignored -> stubIssueList(601, 602, 603, 604, 605, 606).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); @@ -455,7 +457,8 @@ void maintenance_issueAlreadyHasTimedOutNotification() throws IOException { Set.of("triage/needs-reproducer", "triage/needs-feedback"), "area/hibernate-orm", IssueActionSide.OUTSIDER, feedbackProvidedCutoff)) .thenAnswer(ignored -> stubIssueList(201, 202, 203).stream()); - when(repoMock.issuesWithLabelLastUpdatedBefore("area/hibernate-orm", Set.of("triage/on-ice"), staleCutoff)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("area/hibernate-orm", Set.of("triage/on-ice"), + staleCutoff)) .thenAnswer(ignored -> stubIssueList(301, 302, 303, 304, 305, 306).stream()); when(repoMock.issuesLastActedOnByAndLastUpdatedBefore( @@ -466,7 +469,8 @@ void maintenance_issueAlreadyHasTimedOutNotification() throws IOException { Set.of("triage/needs-reproducer", "triage/needs-feedback"), "area/hibernate-search", IssueActionSide.OUTSIDER, feedbackProvidedCutoff)) .thenAnswer(ignored -> stubIssueList(501, 502, 503).stream()); - when(repoMock.issuesWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), staleCutoff)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), + staleCutoff)) .thenAnswer(ignored -> stubIssueList(601, 602, 603, 604, 605, 606).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); @@ -521,7 +525,7 @@ void stewardship() throws IOException { new LotteryConfig.Participant.Participation(3)))))); when(repoMock.fetchLotteryConfig()).thenReturn(Optional.of(config)); - when(repoMock.issuesLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) + when(repoMock.issuesOrPullRequestsLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) .thenAnswer(ignored -> stubIssueList(1, 3, 2, 4).stream()); mockNotifiable("geoand", ZoneOffset.UTC); @@ -560,7 +564,7 @@ void stewardship_issueAlreadyHasNonTimedOutNotification() throws IOException { new LotteryConfig.Participant.Participation(3)))))); when(repoMock.fetchLotteryConfig()).thenReturn(Optional.of(config)); - when(repoMock.issuesLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) + when(repoMock.issuesOrPullRequestsLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) .thenAnswer(ignored -> stubIssueList(1, 3, 2, 4).stream()); mockNotifiable("geoand", ZoneOffset.UTC); @@ -621,10 +625,11 @@ void stewardship_doesNotAffectMaintenance() throws IOException { Set.of("triage/needs-reproducer", "triage/needs-feedback"), "area/hibernate-search", IssueActionSide.OUTSIDER, feedbackProvidedCutoff)) .thenAnswer(ignored -> stubIssueList(501, 502, 503).stream()); - when(repoMock.issuesWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), staleCutoff)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("area/hibernate-search", Set.of("triage/on-ice"), + staleCutoff)) .thenAnswer(ignored -> stubIssueList(601, 602, 603, 604, 605, 606).stream()); - when(repoMock.issuesLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) + when(repoMock.issuesOrPullRequestsLastUpdatedBefore(Set.of("triage/on-ice"), stewardshipCutoff)) .thenAnswer(ignored -> stubIssueList(401, 501, 601, 701).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); @@ -703,7 +708,7 @@ void multiParticipants_evenSpread() throws IOException { Optional.empty()))); when(repoMock.fetchLotteryConfig()).thenReturn(Optional.of(config)); - when(repoMock.issuesWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) + when(repoMock.issuesOrPullRequestsWithLabelLastUpdatedBefore("triage/needs-triage", Set.of(), now)) .thenAnswer(ignored -> stubIssueList(1, 3, 2, 4).stream()); mockNotifiable("yrodiere", ZoneOffset.UTC); diff --git a/src/test/java/io/quarkus/github/lottery/MessageFormatterTest.java b/src/test/java/io/quarkus/github/lottery/MessageFormatterTest.java index b0fa273..74f2ebe 100644 --- a/src/test/java/io/quarkus/github/lottery/MessageFormatterTest.java +++ b/src/test/java/io/quarkus/github/lottery/MessageFormatterTest.java @@ -124,7 +124,7 @@ void formatNotificationBodyMarkdown_triage_simple() { # Triage - Issues that haven't been assigned an area yet. Please add an area label, remove the `triage/needs-triage` label, optionally ping maintainers. + Issues/PRs that haven't been assigned an area yet. Please add an area label, remove the `triage/needs-triage` label, optionally ping maintainers. - [#1](http://github.com/quarkusio/quarkus/issues/1) Title for issue 1 - [#3](http://github.com/quarkusio/quarkus/issues/3) Title for issue 3 @@ -235,7 +235,7 @@ void formatNotificationBodyMarkdown_maintenance_simple() { # Stale - Issues last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... + Issues or PRs last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... - [#2](http://github.com/quarkusio/quarkus/issues/2) Title for issue 2 - [#7](http://github.com/quarkusio/quarkus/issues/7) Title for issue 7 @@ -278,7 +278,7 @@ void formatNotificationBodyMarkdown_stewardship_simple() { # Stewardship - Issues across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... + Issues or PRs across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... - [#1](http://github.com/quarkusio/quarkus/issues/1) Title for issue 1 - [#3](http://github.com/quarkusio/quarkus/issues/3) Title for issue 3 @@ -306,7 +306,7 @@ void formatNotificationBodyMarkdown_all() { # Triage - Issues that haven't been assigned an area yet. Please add an area label, remove the `triage/needs-triage` label, optionally ping maintainers. + Issues/PRs that haven't been assigned an area yet. Please add an area label, remove the `triage/needs-triage` label, optionally ping maintainers. - [#1](http://github.com/quarkusio/quarkus/issues/1) Title for issue 1 - [#3](http://github.com/quarkusio/quarkus/issues/3) Title for issue 3 @@ -327,14 +327,14 @@ void formatNotificationBodyMarkdown_all() { # Stale - Issues last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... + Issues or PRs last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... - [#8](http://github.com/quarkusio/quarkus/issues/8) Title for issue 8 - [#9](http://github.com/quarkusio/quarkus/issues/9) Title for issue 9 # Stewardship - Issues across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue, ... + Issues or PRs across all areas last updated a long time ago. Please have a closer look, re-prioritize, ping someone, label as "on ice", close the issue/PR, ... - [#10](http://github.com/quarkusio/quarkus/issues/10) Title for issue 10 - [#11](http://github.com/quarkusio/quarkus/issues/11) Title for issue 11