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

pr: remove commitCommandUsers #1016

Closed
wants to merge 1 commit 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
@@ -57,7 +57,6 @@ class PullRequestBot implements Bot {
private final String confOverrideName;
private final String confOverrideRef;
private final String censusLink;
private final Set<String> commitCommandUsers;
private final Set<String> autoLabelled;
private final ConcurrentHashMap<String, Instant> scheduledRechecks;
private final PullRequestUpdateCache updateCache;
@@ -74,8 +73,7 @@ class PullRequestBot implements Bot {
Map<String, Pattern> readyComments, IssueProject issueProject,
boolean ignoreStaleReviews, Pattern allowedTargetBranches,
Path seedStorage, HostedRepository confOverrideRepo, String confOverrideName,
String confOverrideRef, String censusLink, List<HostUser> commitCommandUsers,
Map<String, HostedRepository> forks) {
String confOverrideRef, String censusLink, Map<String, HostedRepository> forks) {
remoteRepo = repo;
this.censusRepo = censusRepo;
this.censusRef = censusRef;
@@ -95,9 +93,6 @@ class PullRequestBot implements Bot {
this.confOverrideRef = confOverrideRef;
this.censusLink = censusLink;

this.commitCommandUsers = commitCommandUsers.stream()
.map(HostUser::id)
.collect(Collectors.toSet());
this.forks = forks;

autoLabelled = new HashSet<>();
@@ -196,16 +191,13 @@ public List<WorkItem> getPeriodicItems() {
prs = remoteRepo.pullRequests(ZonedDateTime.now().minus(Duration.ofDays(1)));
}

if (!commitCommandUsers.isEmpty()) {
commitComments = remoteRepo.recentCommitComments().stream()
.filter(cc -> !processedCommitComments.contains(cc.id()))
.filter(cc -> commitCommandUsers.contains(cc.author().id()))
.collect(Collectors.toList());
if (!commitComments.isEmpty()) {
processedCommitComments.addAll(commitComments.stream()
.map(Comment::id)
.collect(Collectors.toList()));
}
commitComments = remoteRepo.recentCommitComments().stream()
.filter(cc -> !processedCommitComments.contains(cc.id()))
.collect(Collectors.toList());
if (!commitComments.isEmpty()) {
processedCommitComments.addAll(commitComments.stream()
.map(Comment::id)
.collect(Collectors.toList()));
}

return getWorkItems(prs, commitComments);
@@ -51,7 +51,6 @@ public class PullRequestBotBuilder {
private String confOverrideName = ".conf/jcheck";
private String confOverrideRef = Branch.defaultFor(VCS.GIT).name();
private String censusLink = null;
private List<HostUser> commitCommandUsers = List.of();
private Map<String, HostedRepository> forks = Map.of();

PullRequestBotBuilder() {
@@ -147,11 +146,6 @@ public PullRequestBotBuilder censusLink(String censusLink) {
return this;
}

public PullRequestBotBuilder commitCommandUsers(List<HostUser> commitCommandUsers) {
this.commitCommandUsers = commitCommandUsers;
return this;
}

public PullRequestBotBuilder forks(Map<String, HostedRepository> forks) {
this.forks = forks;
return this;
@@ -162,6 +156,6 @@ public PullRequestBot build() {
blockingCheckLabels, readyLabels, twoReviewersLabels, twentyFourHoursLabels,
readyComments, issueProject, ignoreStaleReviews,
allowedTargetBranches, seedStorage, confOverrideRepo, confOverrideName,
confOverrideRef, censusLink, commitCommandUsers, forks);
confOverrideRef, censusLink, forks);
}
}
@@ -141,14 +141,6 @@ public List<Bot> create(BotConfiguration configuration) {
botBuilder.censusLink(repo.value().get("censuslink").asString());
}

if (repo.value().contains("commitcommanders")) {
var allowed = repo.value().get("commitcommanders").stream()
.map(JSONValue::asString)
.map(s -> HostUser.builder().id(s).build())
.collect(Collectors.toList());
botBuilder.commitCommandUsers(allowed);
}

ret.add(botBuilder.build());
}

@@ -47,7 +47,6 @@ void simple(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

@@ -115,7 +114,6 @@ void unknownTargetRepo(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

@@ -157,7 +155,6 @@ void unknownTargetBranch(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

@@ -199,7 +196,6 @@ void backportDoesNotApply(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

@@ -46,7 +46,6 @@ void simple(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.build();

// Populate the projects repository
@@ -92,7 +91,6 @@ void simplePullRequest(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.build();

// Populate the projects repository