95 var cur = postIterator.next();
96 if (cur == post) {
97 break;
98 }
99 }
100
101 while (postIterator.hasPrevious()) {
102 var cur = postIterator.previous();
103 var userMatcher = replyToNamePattern.matcher(cur.author().userName());
104 if (userMatcher.matches()) {
105 return Optional.of(cur);
106 }
107 }
108 }
109
110 return Optional.empty();
111 }
112
113 private Repository materializeArchive(Path scratchPath) {
114 try {
115 return Repository.materialize(scratchPath, bot.archiveRepo().url(), pr.targetRef());
116 } catch (IOException e) {
117 throw new UncheckedIOException(e);
118 }
119 }
120
121 private final static Pattern commandPattern = Pattern.compile("^/.*$");
122
123 private boolean ignoreComment(HostUser author, String body) {
124 if (pr.repository().forge().currentUser().equals(author)) {
125 return true;
126 }
127 if (bot.ignoredUsers().contains(author.userName())) {
128 return true;
129 }
130 var commandMatcher = commandPattern.matcher(body);
131 if (commandMatcher.matches()) {
132 return true;
133 }
134 for (var ignoredCommentPattern : bot.ignoredComments()) {
135 var ignoredCommentMatcher = ignoredCommentPattern.matcher(body);
|
95 var cur = postIterator.next();
96 if (cur == post) {
97 break;
98 }
99 }
100
101 while (postIterator.hasPrevious()) {
102 var cur = postIterator.previous();
103 var userMatcher = replyToNamePattern.matcher(cur.author().userName());
104 if (userMatcher.matches()) {
105 return Optional.of(cur);
106 }
107 }
108 }
109
110 return Optional.empty();
111 }
112
113 private Repository materializeArchive(Path scratchPath) {
114 try {
115 return Repository.materialize(scratchPath, bot.archiveRepo().url(),
116 "+" + bot.archiveRef() + ":mlbridge_archive");
117 } catch (IOException e) {
118 throw new UncheckedIOException(e);
119 }
120 }
121
122 private final static Pattern commandPattern = Pattern.compile("^/.*$");
123
124 private boolean ignoreComment(HostUser author, String body) {
125 if (pr.repository().forge().currentUser().equals(author)) {
126 return true;
127 }
128 if (bot.ignoredUsers().contains(author.userName())) {
129 return true;
130 }
131 var commandMatcher = commandPattern.matcher(body);
132 if (commandMatcher.matches()) {
133 return true;
134 }
135 for (var ignoredCommentPattern : bot.ignoredComments()) {
136 var ignoredCommentMatcher = ignoredCommentPattern.matcher(body);
|