diff --git a/bots/bridgekeeper/src/main/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBot.java b/bots/bridgekeeper/src/main/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBot.java index 253b097ed..499b4fb65 100644 --- a/bots/bridgekeeper/src/main/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBot.java +++ b/bots/bridgekeeper/src/main/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBot.java @@ -40,7 +40,7 @@ class PullRequestPrunerBotWorkItem implements WorkItem { PullRequestPrunerBotWorkItem(PullRequest pr, Duration maxAge) { this.pr = pr; - this.maxAge = maxAge; + this.maxAge = pr.isDraft() ? maxAge.multipliedBy(2) : maxAge; } @Override @@ -83,7 +83,8 @@ public Collection run(Path scratchPath) { if (lastComment.author().equals(pr.repository().forge().currentUser()) && lastComment.body().contains(noticeMarker)) { var message = "@" + pr.author().username() + " This pull request has been inactive for more than " + formatDuration(maxAge.multipliedBy(2)) + " and will now be automatically closed. If you would " + - "like to continue working on this pull request in the future, feel free to reopen it!"; + "like to continue working on this pull request in the future, feel free to reopen it! This can be done " + + "using the `/open` pull request command."; log.fine("Posting prune message"); pr.addComment(message); pr.setState(PullRequest.State.CLOSED); diff --git a/bots/bridgekeeper/src/test/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBotTests.java b/bots/bridgekeeper/src/test/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBotTests.java index 3522a7ac3..2611e0a1a 100644 --- a/bots/bridgekeeper/src/test/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBotTests.java +++ b/bots/bridgekeeper/src/test/java/org/openjdk/skara/bots/bridgekeeper/PullRequestPrunerBotTests.java @@ -79,6 +79,10 @@ void close(TestInfo testInfo) throws IOException, InterruptedException { // There should now be no open PRs var prs = author.pullRequests(); assertEquals(0, prs.size()); + + // There should be a mention on how to reopen + var comment = pr.comments().get(pr.comments().size() - 1).body(); + assertTrue(comment.contains("`/open`"), comment); } }