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

831: Longer time for autoclose on passive PRs #1131

Closed
wants to merge 1 commit into from
Closed
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
@@ -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<WorkItem> 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);
@@ -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);
}
}