diff --git a/src/main/java/org/bf2/arch/bot/ArchBotConfig.java b/src/main/java/org/bf2/arch/bot/ArchBotConfig.java index 0f6218c..2b3e782 100644 --- a/src/main/java/org/bf2/arch/bot/ArchBotConfig.java +++ b/src/main/java/org/bf2/arch/bot/ArchBotConfig.java @@ -15,11 +15,13 @@ public class ArchBotConfig { /** * Github login name of the bot itself. */ + @JsonDeserialize String botUserLogin; /** * The time, in minutes, to wait between checking for stalled discussions. */ + @JsonDeserialize long stalledDiscussionPollTimeMins; /** @@ -31,7 +33,8 @@ public class ArchBotConfig { /** * The URL at which the site is published. */ - String publishedUrl = "https://architecture.appservices.tech"; + @JsonDeserialize + String publishedUrl; @Override public String toString() { diff --git a/src/main/java/org/bf2/arch/bot/StalledDiscussionFlow.java b/src/main/java/org/bf2/arch/bot/StalledDiscussionFlow.java index 7f115f5..9068989 100644 --- a/src/main/java/org/bf2/arch/bot/StalledDiscussionFlow.java +++ b/src/main/java/org/bf2/arch/bot/StalledDiscussionFlow.java @@ -70,7 +70,6 @@ void init(GitHubService service, GitHubConfigFileProvider configFileProvider) th Optional oconfig = configFileProvider.fetchConfigFile(client.getRepository(repositoryPath), Util.CONFIG_REPO_PATH, ConfigFile.Source.DEFAULT, ArchBotConfig.class); config = oconfig.orElseThrow(); - LOG.info("CONFIGG: {}", config); } else { throw new RuntimeException("installation id is requied"); } @@ -122,7 +121,7 @@ public void checkForStalledDiscussions() throws IOException { .list(); LOG.info("Top-level query found {} PRs", results.getTotalCount()); for (GHIssue issue : results) { -try { + try { GHPullRequest pullRequest = Util.findPullRequest(issue); if (pullRequest == null) { LOG.info("Issue#{} is not a PR, ignoring", issue.getNumber()); @@ -137,14 +136,14 @@ public void checkForStalledDiscussions() throws IOException { Date lastCommentDate; LOG.info("COMMENTS COUNT: {}", pullRequest.listReviewComments().toList().size()); var mostRecent = pullRequest.listReviewComments().toList().stream() - .filter(pr -> { - try { - return !Util.isThisBot(config, pr.getUser()); - } catch (IOException e) { - return true; - } - }) - .map(comment -> { + .filter(pr -> { + try { + return !Util.isThisBot(config, pr.getUser()); + } catch (IOException e) { + return true; + } + }) + .map(comment -> { try { LOG.info("Comment: {}", comment.getBody()); LOG.info("User: {}", comment.getUser().getLogin()); @@ -155,16 +154,16 @@ public void checkForStalledDiscussions() throws IOException { }).max(Date::compareTo); lastCommentDate = mostRecent.orElseGet(() -> { - try { - return pullRequest.getUpdatedAt(); - } catch (IOException e) { try { - return pullRequest.getCreatedAt(); - } catch (IOException ex) { - return new Date(0); + return pullRequest.getUpdatedAt(); + } catch (IOException e) { + try { + return pullRequest.getCreatedAt(); + } catch (IOException ex) { + return new Date(0); + } } - } - }); + }); LOG.info("PR#{}: Last comment time {}", pullRequest.getNumber(), lastCommentDate); if (lastCommentDate.getTime() < thresh) {