From b5730bcc0b261392df3fbfeaf0152a1403d26de4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:45:05 +0200 Subject: [PATCH 01/18] Bump org.flywaydb:flyway-core from 9.21.0 to 9.22.0 (#880) Bumps [org.flywaydb:flyway-core](https://github.com/flyway/flyway) from 9.21.0 to 9.22.0. - [Release notes](https://github.com/flyway/flyway/releases) - [Commits](https://github.com/flyway/flyway/compare/flyway-9.21.0...flyway-9.22.0) --- updated-dependencies: - dependency-name: org.flywaydb:flyway-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- database/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/build.gradle b/database/build.gradle index 0a7af61b10..7efbb4583d 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -7,7 +7,7 @@ var sqliteVersion = "3.42.0.0" dependencies { implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation "org.xerial:sqlite-jdbc:${sqliteVersion}" - implementation 'org.flywaydb:flyway-core:9.21.0' + implementation 'org.flywaydb:flyway-core:9.22.0' implementation "org.jooq:jooq:$jooqVersion" implementation project(':utils') From 01ffaaeb6514cc9c54c04a80cc989bb09a5dbaf0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:45:18 +0200 Subject: [PATCH 02/18] Bump gradle.plugin.org.flywaydb:gradle-plugin-publishing (#879) Bumps gradle.plugin.org.flywaydb:gradle-plugin-publishing from 9.21.0 to 9.22.0. --- updated-dependencies: - dependency-name: gradle.plugin.org.flywaydb:gradle-plugin-publishing dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- buildSrc/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 43a10c37a6..fd7f55577c 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -7,6 +7,6 @@ repositories { } dependencies { - implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:9.21.0" + implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:9.22.0" implementation 'nu.studer:gradle-jooq-plugin:8.2' } From 5874437451a44ff18182905699d0def82068bb4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:45:31 +0200 Subject: [PATCH 03/18] Bump org.xerial:sqlite-jdbc from 3.42.0.0 to 3.43.0.0 (#878) Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.42.0.0 to 3.43.0.0. - [Release notes](https://github.com/xerial/sqlite-jdbc/releases) - [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG) - [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.42.0.0...3.43.0.0) --- updated-dependencies: - dependency-name: org.xerial:sqlite-jdbc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- application/build.gradle | 2 +- database/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/build.gradle b/application/build.gradle index 5050f0852a..dda761af2e 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -1,6 +1,6 @@ buildscript { dependencies { - classpath 'org.xerial:sqlite-jdbc:3.42.0.0' + classpath 'org.xerial:sqlite-jdbc:3.43.0.0' } } diff --git a/database/build.gradle b/database/build.gradle index 7efbb4583d..55c940a648 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' } -var sqliteVersion = "3.42.0.0" +var sqliteVersion = "3.43.0.0" dependencies { implementation 'com.google.code.findbugs:jsr305:3.0.2' From 07292e60eef3cf0f0b4cc1e036fa6a0dba73e0be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:46:04 +0200 Subject: [PATCH 04/18] Bump com.diffplug.spotless from 6.20.0 to 6.21.0 (#877) Bumps com.diffplug.spotless from 6.20.0 to 6.21.0. --- updated-dependencies: - dependency-name: com.diffplug.spotless dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e511f8be55..d30d7a522e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id "com.diffplug.spotless" version "6.20.0" + id "com.diffplug.spotless" version "6.21.0" id "org.sonarqube" version "4.3.0.3225" id "name.remal.sonarlint" version "3.3.0" } From b90fce6ba451805f5af4caa87739febbc05673d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:46:23 +0200 Subject: [PATCH 05/18] Bump chatGPTVersion from 0.14.0 to 0.16.0 (#876) Bumps `chatGPTVersion` from 0.14.0 to 0.16.0. Updates `com.theokanning.openai-gpt3-java:api` from 0.14.0 to 0.16.0 - [Release notes](https://github.com/theokanning/openai-java/releases) - [Commits](https://github.com/theokanning/openai-java/compare/0.14.0...0.16.0) Updates `com.theokanning.openai-gpt3-java:service` from 0.14.0 to 0.16.0 - [Release notes](https://github.com/theokanning/openai-java/releases) - [Commits](https://github.com/theokanning/openai-java/compare/0.14.0...0.16.0) --- updated-dependencies: - dependency-name: com.theokanning.openai-gpt3-java:api dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.theokanning.openai-gpt3-java:service dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d30d7a522e..1e648c367b 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ version '1.0-SNAPSHOT' ext { jooqVersion = '3.18.0' jacksonVersion = '2.15.0' - chatGPTVersion = '0.14.0' + chatGPTVersion = '0.16.0' } // Skips sonarlint during the build, useful for testing purposes. From d1da70884cb46ac8b63dcf38a30ea46938c9e2d2 Mon Sep 17 00:00:00 2001 From: Tanish Date: Mon, 11 Sep 2023 23:48:58 +0530 Subject: [PATCH 06/18] use - in channel names (#853) --- application/config.json.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config.json.template b/application/config.json.template index 02c6027d9e..f41d93472e 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -4,7 +4,7 @@ "databasePath": "local-database.db", "projectWebsite": "https://github.com/Together-Java/TJ-Bot", "discordGuildInvite": "https://discord.com/invite/XXFUXzK", - "modAuditLogChannelPattern": "mod_audit_log", + "modAuditLogChannelPattern": "mod-audit-log", "modMailChannelPattern": "modmail", "mutedRolePattern": "Muted", "heavyModerationRolePattern": "Moderator", @@ -12,7 +12,7 @@ "tagManageRolePattern": "Moderator|Community Ambassador|Top Helpers .+", "excludeCodeAutoDetectionRolePattern": "Top Helpers .+|Moderator|Community Ambassador|Expert", "suggestions": { - "channelPattern": "tj_suggestions", + "channelPattern": "tj-suggestions", "upVoteEmoteName": "peepo_yes", "downVoteEmoteName": "peepo_no" }, From 92e36aa67e8341cb9298c07c4297aa9ab746d65e Mon Sep 17 00:00:00 2001 From: Zabuzard Date: Mon, 18 Sep 2023 09:43:33 +0200 Subject: [PATCH 07/18] typo in config template (missing comma) --- application/config.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config.json.template b/application/config.json.template index f41d93472e..0ce8d2c59d 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -89,7 +89,7 @@ "logInfoChannelWebhook": "", "logErrorChannelWebhook": "", "openaiApiKey": "", - "sourceCodeBaseUrl": "//blob/master/application/src/main/java/>" + "sourceCodeBaseUrl": "//blob/master/application/src/main/java/>", "jshell": { "baseUrl": "", "rateLimitWindowSeconds": 10, From e9a7f32c49e8220458d9a0f5ff4866dcc5dd43ba Mon Sep 17 00:00:00 2001 From: Daniel Tischner Date: Mon, 18 Sep 2023 10:35:22 +0200 Subject: [PATCH 08/18] Fixed some ChatGPT issues (#888) * url must not be fake * fixed chatgpt disabling * chatgpt logs too much * answer-attempt should be after explanation messages --- application/config.json.template | 2 +- .../tjbot/features/chatgpt/ChatGptService.java | 7 +++++-- .../togetherjava/tjbot/features/help/HelpSystemHelper.java | 2 -- .../tjbot/features/help/HelpThreadCreatedListener.java | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/application/config.json.template b/application/config.json.template index 0ce8d2c59d..80585e39b4 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -89,7 +89,7 @@ "logInfoChannelWebhook": "", "logErrorChannelWebhook": "", "openaiApiKey": "", - "sourceCodeBaseUrl": "//blob/master/application/src/main/java/>", + "sourceCodeBaseUrl": "https://github.com/Together-Java/TJ-Bot/blob/master/application/src/main/java/", "jshell": { "baseUrl": "", "rateLimitWindowSeconds": 10, diff --git a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java index 11f057e296..24cf088852 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java @@ -23,8 +23,9 @@ public class ChatGptService { private static final Duration TIMEOUT = Duration.ofSeconds(90); private static final int MAX_TOKENS = 3_000; private static final String AI_MODEL = "gpt-3.5-turbo"; + private boolean isDisabled = false; - private final OpenAiService openAiService; + private OpenAiService openAiService; /** * Creates instance of ChatGPTService @@ -33,8 +34,10 @@ public class ChatGptService { */ public ChatGptService(Config config) { String apiKey = config.getOpenaiApiKey(); - if (apiKey.isBlank()) { + boolean keyIsDefaultDescription = apiKey.startsWith("<") && apiKey.endsWith(">"); + if (apiKey.isBlank() || keyIsDefaultDescription) { isDisabled = true; + return; } openAiService = new OpenAiService(apiKey, TIMEOUT); diff --git a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java index 1fa5dcaf7c..8604ac631b 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java @@ -170,7 +170,6 @@ RestAction constructChatGptAttempt(ThreadChannel threadChannel, } String question = questionOptional.get(); logger.debug("The final question sent to chatGPT: {}", question); - logger.info("The final question sent to chatGPT: {}", question); chatGPTAnswer = chatGptService.ask(question); if (chatGPTAnswer.isEmpty()) { @@ -226,7 +225,6 @@ private Optional prepareChatGptQuestion(ThreadChannel threadChannel, } private RestAction useChatGptFallbackMessage(ThreadChannel threadChannel) { - logger.warn("Something went wrong while trying to communicate with the ChatGpt API"); return mentionGuildSlashCommand(threadChannel.getGuild(), ChatGptCommand.COMMAND_NAME) .map(CHATGPT_FAILURE_MESSAGE::formatted) .flatMap(threadChannel::sendMessage); diff --git a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java index b38d35fcc1..6bbf80eff7 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java @@ -77,7 +77,6 @@ private void handleHelpThreadCreated(ThreadChannel threadChannel) { Runnable createMessages = () -> { try { createMessages(threadChannel).queue(); - createAIResponse(threadChannel).queue(); } catch (Exception e) { logger.error( "Unknown error while creating messages after help-thread ({}) creation", @@ -100,7 +99,8 @@ private RestAction createAIResponse(ThreadChannel threadChannel) { private RestAction createMessages(ThreadChannel threadChannel) { return sendHelperHeadsUp(threadChannel).flatMap(Message::pin) - .flatMap(any -> helper.sendExplanationMessage(threadChannel)); + .flatMap(any -> helper.sendExplanationMessage(threadChannel)) + .flatMap(any -> createAIResponse(threadChannel)); } private RestAction sendHelperHeadsUp(ThreadChannel threadChannel) { From 69d4f785e670fd1f0d49ccd5337c1e34d8bad0c8 Mon Sep 17 00:00:00 2001 From: Daniel Tischner Date: Mon, 18 Sep 2023 11:18:57 +0200 Subject: [PATCH 09/18] added helper prune config (#889) --- application/config.json.template | 7 ++++ .../org/togetherjava/tjbot/config/Config.java | 15 ++++++++- .../tjbot/config/HelperPruneConfig.java | 19 +++++++++++ .../features/help/AutoPruneHelperRoutine.java | 32 ++++++++++++------- 4 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 application/src/main/java/org/togetherjava/tjbot/config/HelperPruneConfig.java diff --git a/application/config.json.template b/application/config.json.template index 80585e39b4..5391037110 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -94,5 +94,12 @@ "baseUrl": "", "rateLimitWindowSeconds": 10, "rateLimitRequestsInWindow": 3 + }, + "helperPruneConfig": { + "roleFullLimit": 100, + "roleFullThreshold": 95, + "pruneMemberAmount": 7, + "inactivateAfterDays": 90, + "recentlyJoinedDays": 4 } } diff --git a/application/src/main/java/org/togetherjava/tjbot/config/Config.java b/application/src/main/java/org/togetherjava/tjbot/config/Config.java index f16aed61b4..4697573b06 100644 --- a/application/src/main/java/org/togetherjava/tjbot/config/Config.java +++ b/application/src/main/java/org/togetherjava/tjbot/config/Config.java @@ -39,6 +39,7 @@ public final class Config { private final String openaiApiKey; private final String sourceCodeBaseUrl; private final JShellConfig jshell; + private final HelperPruneConfig helperPruneConfig; @SuppressWarnings("ConstructorWithTooManyParameters") @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) @@ -76,7 +77,9 @@ private Config(@JsonProperty(value = "token", required = true) String token, required = true) String logErrorChannelWebhook, @JsonProperty(value = "openaiApiKey", required = true) String openaiApiKey, @JsonProperty(value = "sourceCodeBaseUrl", required = true) String sourceCodeBaseUrl, - @JsonProperty(value = "jshell", required = true) JShellConfig jshell) { + @JsonProperty(value = "jshell", required = true) JShellConfig jshell, + @JsonProperty(value = "helperPruneConfig", + required = true) HelperPruneConfig helperPruneConfig) { this.token = Objects.requireNonNull(token); this.gistApiKey = Objects.requireNonNull(gistApiKey); this.databasePath = Objects.requireNonNull(databasePath); @@ -102,6 +105,7 @@ private Config(@JsonProperty(value = "token", required = true) String token, this.openaiApiKey = Objects.requireNonNull(openaiApiKey); this.sourceCodeBaseUrl = Objects.requireNonNull(sourceCodeBaseUrl); this.jshell = Objects.requireNonNull(jshell); + this.helperPruneConfig = Objects.requireNonNull(helperPruneConfig); } /** @@ -342,4 +346,13 @@ public String getSourceCodeBaseUrl() { public JShellConfig getJshell() { return jshell; } + + /** + * Gets the config for automatic pruning of helper roles. + * + * @return the configuration + */ + public HelperPruneConfig getHelperPruneConfig() { + return helperPruneConfig; + } } diff --git a/application/src/main/java/org/togetherjava/tjbot/config/HelperPruneConfig.java b/application/src/main/java/org/togetherjava/tjbot/config/HelperPruneConfig.java new file mode 100644 index 0000000000..6f451b491f --- /dev/null +++ b/application/src/main/java/org/togetherjava/tjbot/config/HelperPruneConfig.java @@ -0,0 +1,19 @@ +package org.togetherjava.tjbot.config; + + +/** + * Config for automatic pruning of helper roles, see + * {@link org.togetherjava.tjbot.features.help.AutoPruneHelperRoutine}. + * + * @param roleFullLimit if a helper role contains that many users, it is considered full and pruning + * must occur + * @param roleFullThreshold if a helper role contains that many users, pruning will start to occur + * to prevent reaching the limit + * @param pruneMemberAmount amount of users to remove from helper roles during a prune + * @param inactivateAfterDays after how many days of inactivity a user is eligible for pruning + * @param recentlyJoinedDays if a user is with the server for just this amount of days, they are + * protected from pruning + */ +public record HelperPruneConfig(int roleFullLimit, int roleFullThreshold, int pruneMemberAmount, + int inactivateAfterDays, int recentlyJoinedDays) { +} diff --git a/application/src/main/java/org/togetherjava/tjbot/features/help/AutoPruneHelperRoutine.java b/application/src/main/java/org/togetherjava/tjbot/features/help/AutoPruneHelperRoutine.java index 183dd2ab79..9fcd05e4ef 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/help/AutoPruneHelperRoutine.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/help/AutoPruneHelperRoutine.java @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory; import org.togetherjava.tjbot.config.Config; +import org.togetherjava.tjbot.config.HelperPruneConfig; import org.togetherjava.tjbot.db.Database; import org.togetherjava.tjbot.features.Routine; import org.togetherjava.tjbot.features.moderation.audit.ModAuditLogWriter; @@ -31,11 +32,11 @@ public final class AutoPruneHelperRoutine implements Routine { private static final Logger logger = LoggerFactory.getLogger(AutoPruneHelperRoutine.class); - private static final int ROLE_FULL_LIMIT = 100; - private static final int ROLE_FULL_THRESHOLD = 95; - private static final int PRUNE_MEMBER_AMOUNT = 7; - private static final Period INACTIVE_AFTER = Period.ofDays(90); - private static final int RECENTLY_JOINED_DAYS = 4; + private final int roleFullLimit; + private final int roleFullThreshold; + private final int pruneMemberAmount; + private final Period inactiveAfter; + private final int recentlyJoinedDays; private final HelpSystemHelper helper; private final ModAuditLogWriter modAuditLogWriter; @@ -56,6 +57,13 @@ public AutoPruneHelperRoutine(Config config, HelpSystemHelper helper, this.helper = helper; this.modAuditLogWriter = modAuditLogWriter; this.database = database; + + HelperPruneConfig helperPruneConfig = config.getHelperPruneConfig(); + roleFullLimit = helperPruneConfig.roleFullLimit(); + roleFullThreshold = helperPruneConfig.roleFullThreshold(); + pruneMemberAmount = helperPruneConfig.pruneMemberAmount(); + inactiveAfter = Period.ofDays(helperPruneConfig.inactivateAfterDays()); + recentlyJoinedDays = helperPruneConfig.recentlyJoinedDays(); } @Override @@ -93,7 +101,7 @@ private void pruneRoleIfFull(Role role, ForumChannel helpForum, Instant when) { } private boolean isRoleFull(Collection members) { - return members.size() >= ROLE_FULL_THRESHOLD; + return members.size() >= roleFullThreshold; } private void pruneRole(Role role, List members, ForumChannel helpForum, @@ -103,18 +111,18 @@ private void pruneRole(Role role, List members, ForumChannel h List membersToPrune = membersShuffled.stream() .filter(member -> isMemberInactive(member, when)) - .limit(PRUNE_MEMBER_AMOUNT) + .limit(pruneMemberAmount) .toList(); - if (membersToPrune.size() < PRUNE_MEMBER_AMOUNT) { + if (membersToPrune.size() < pruneMemberAmount) { warnModsAbout( "Attempting to prune helpers from role **%s** (%d members), but only found %d inactive users. That is less than expected, the category might eventually grow beyond the limit." .formatted(role.getName(), members.size(), membersToPrune.size()), role.getGuild()); } - if (members.size() - membersToPrune.size() >= ROLE_FULL_LIMIT) { + if (members.size() - membersToPrune.size() >= roleFullLimit) { warnModsAbout( "The helper role **%s** went beyond its member limit (%d), despite automatic pruning. It will not function correctly anymore. Please manually prune some users." - .formatted(role.getName(), ROLE_FULL_LIMIT), + .formatted(role.getName(), roleFullLimit), role.getGuild()); } @@ -126,14 +134,14 @@ private void pruneRole(Role role, List members, ForumChannel h private boolean isMemberInactive(Member member, Instant when) { if (member.hasTimeJoined()) { Instant memberJoined = member.getTimeJoined().toInstant(); - if (Duration.between(memberJoined, when).toDays() <= RECENTLY_JOINED_DAYS) { + if (Duration.between(memberJoined, when).toDays() <= recentlyJoinedDays) { // New users are protected from purging to not immediately kick them out of the role // again return false; } } - Instant latestActiveMoment = when.minus(INACTIVE_AFTER); + Instant latestActiveMoment = when.minus(inactiveAfter); // Has no recent help message return database.read(context -> context.fetchCount(HELP_CHANNEL_MESSAGES, From 48230006ec36f9a4afdd386e930d4b0b21f7c8b8 Mon Sep 17 00:00:00 2001 From: Zabuzard Date: Mon, 18 Sep 2023 11:23:45 +0200 Subject: [PATCH 10/18] temporarily disable jshell --- .../togetherjava/tjbot/features/Features.java | 26 +++---------------- .../features/code/CodeMessageHandler.java | 2 +- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/application/src/main/java/org/togetherjava/tjbot/features/Features.java b/application/src/main/java/org/togetherjava/tjbot/features/Features.java index 58c34ca949..e5186ad087 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/Features.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/Features.java @@ -18,32 +18,12 @@ import org.togetherjava.tjbot.features.code.CodeMessageHandler; import org.togetherjava.tjbot.features.code.CodeMessageManualDetection; import org.togetherjava.tjbot.features.filesharing.FileSharingMessageListener; -import org.togetherjava.tjbot.features.help.AutoPruneHelperRoutine; -import org.togetherjava.tjbot.features.help.GuildLeaveCloseThreadListener; -import org.togetherjava.tjbot.features.help.HelpSystemHelper; -import org.togetherjava.tjbot.features.help.HelpThreadActivityUpdater; -import org.togetherjava.tjbot.features.help.HelpThreadAutoArchiver; -import org.togetherjava.tjbot.features.help.HelpThreadCommand; -import org.togetherjava.tjbot.features.help.HelpThreadCreatedListener; -import org.togetherjava.tjbot.features.help.HelpThreadMetadataPurger; -import org.togetherjava.tjbot.features.jshell.JShellCommand; +import org.togetherjava.tjbot.features.help.*; import org.togetherjava.tjbot.features.jshell.JShellEval; import org.togetherjava.tjbot.features.mathcommands.TeXCommand; import org.togetherjava.tjbot.features.mathcommands.wolframalpha.WolframAlphaCommand; import org.togetherjava.tjbot.features.mediaonly.MediaOnlyChannelListener; -import org.togetherjava.tjbot.features.moderation.BanCommand; -import org.togetherjava.tjbot.features.moderation.KickCommand; -import org.togetherjava.tjbot.features.moderation.ModerationActionsStore; -import org.togetherjava.tjbot.features.moderation.MuteCommand; -import org.togetherjava.tjbot.features.moderation.NoteCommand; -import org.togetherjava.tjbot.features.moderation.QuarantineCommand; -import org.togetherjava.tjbot.features.moderation.RejoinModerationRoleListener; -import org.togetherjava.tjbot.features.moderation.ReportCommand; -import org.togetherjava.tjbot.features.moderation.UnbanCommand; -import org.togetherjava.tjbot.features.moderation.UnmuteCommand; -import org.togetherjava.tjbot.features.moderation.UnquarantineCommand; -import org.togetherjava.tjbot.features.moderation.WarnCommand; -import org.togetherjava.tjbot.features.moderation.WhoIsCommand; +import org.togetherjava.tjbot.features.moderation.*; import org.togetherjava.tjbot.features.moderation.attachment.BlacklistedAttachmentListener; import org.togetherjava.tjbot.features.moderation.audit.AuditCommand; import org.togetherjava.tjbot.features.moderation.audit.ModAuditLogRoutine; @@ -171,7 +151,7 @@ public static Collection createFeatures(JDA jda, Database database, Con features.add(new ReportCommand(config)); features.add(new BookmarksCommand(bookmarksSystem)); features.add(new ChatGptCommand(chatGptService)); - features.add(new JShellCommand(jshellEval)); + // features.add(new JShellCommand(jshellEval)); return features; } } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java b/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java index a26cde9f1c..f4d27e85d5 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java @@ -70,7 +70,7 @@ public CodeMessageHandler(JShellEval jshellEval) { componentIdInteractor = new ComponentIdInteractor(getInteractionType(), getName()); List codeActions = - List.of(new FormatCodeCommand(), new EvalCodeCommand(jshellEval)); + List.of(new FormatCodeCommand()/* , new EvalCodeCommand(jshellEval) */); labelToCodeAction = codeActions.stream() .collect(Collectors.toMap(CodeAction::getLabel, Function.identity(), (x, y) -> y, From fb149bc13558b2611db04849caa0a673da3ba401 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:50:14 +0200 Subject: [PATCH 11/18] Bump org.kohsuke:github-api from 1.315 to 1.316 (#874) Bumps [org.kohsuke:github-api](https://github.com/hub4j/github-api) from 1.315 to 1.316. - [Release notes](https://github.com/hub4j/github-api/releases) - [Changelog](https://github.com/hub4j/github-api/blob/main/CHANGELOG.md) - [Commits](https://github.com/hub4j/github-api/compare/github-api-1.315...github-api-1.316) --- updated-dependencies: - dependency-name: org.kohsuke:github-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- application/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/build.gradle b/application/build.gradle index dda761af2e..c8ad29bf65 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -74,7 +74,7 @@ dependencies { implementation 'com.github.ben-manes.caffeine:caffeine:3.1.1' - implementation 'org.kohsuke:github-api:1.315' + implementation 'org.kohsuke:github-api:1.316' testImplementation 'org.mockito:mockito-core:5.3.1' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' From 2bd3c3f296352a76edade5f69fb0f4cf0d568a45 Mon Sep 17 00:00:00 2001 From: Alathreon <45936420+Alathreon@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:09:57 +0200 Subject: [PATCH 12/18] [FeatureBlacklist] Done (#886) --- application/config.json.template | 6 ++++ .../org/togetherjava/tjbot/config/Config.java | 15 +++++++- .../tjbot/config/FeatureBlacklist.java | 35 +++++++++++++++++++ .../tjbot/config/FeatureBlacklistConfig.java | 28 +++++++++++++++ .../togetherjava/tjbot/features/Features.java | 13 +++++-- .../features/code/CodeMessageHandler.java | 12 +++++-- 6 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklist.java create mode 100644 application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklistConfig.java diff --git a/application/config.json.template b/application/config.json.template index 5391037110..56a02ecc39 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -101,5 +101,11 @@ "pruneMemberAmount": 7, "inactivateAfterDays": 90, "recentlyJoinedDays": 4 + }, + "feature_blacklist": { + "normal": [ + ], + "special": [ + ] } } diff --git a/application/src/main/java/org/togetherjava/tjbot/config/Config.java b/application/src/main/java/org/togetherjava/tjbot/config/Config.java index 4697573b06..161bfe75fd 100644 --- a/application/src/main/java/org/togetherjava/tjbot/config/Config.java +++ b/application/src/main/java/org/togetherjava/tjbot/config/Config.java @@ -40,6 +40,7 @@ public final class Config { private final String sourceCodeBaseUrl; private final JShellConfig jshell; private final HelperPruneConfig helperPruneConfig; + private final FeatureBlacklistConfig featureBlacklistConfig; @SuppressWarnings("ConstructorWithTooManyParameters") @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) @@ -79,7 +80,9 @@ private Config(@JsonProperty(value = "token", required = true) String token, @JsonProperty(value = "sourceCodeBaseUrl", required = true) String sourceCodeBaseUrl, @JsonProperty(value = "jshell", required = true) JShellConfig jshell, @JsonProperty(value = "helperPruneConfig", - required = true) HelperPruneConfig helperPruneConfig) { + required = true) HelperPruneConfig helperPruneConfig, + @JsonProperty(value = "featureBlacklist", + required = true) FeatureBlacklistConfig featureBlacklistConfig) { this.token = Objects.requireNonNull(token); this.gistApiKey = Objects.requireNonNull(gistApiKey); this.databasePath = Objects.requireNonNull(databasePath); @@ -106,6 +109,7 @@ private Config(@JsonProperty(value = "token", required = true) String token, this.sourceCodeBaseUrl = Objects.requireNonNull(sourceCodeBaseUrl); this.jshell = Objects.requireNonNull(jshell); this.helperPruneConfig = Objects.requireNonNull(helperPruneConfig); + this.featureBlacklistConfig = Objects.requireNonNull(featureBlacklistConfig); } /** @@ -355,4 +359,13 @@ public JShellConfig getJshell() { public HelperPruneConfig getHelperPruneConfig() { return helperPruneConfig; } + + /** + * The configuration of blacklisted features. + * + * @return configuration of blacklisted features + */ + public FeatureBlacklistConfig getFeatureBlacklistConfig() { + return featureBlacklistConfig; + } } diff --git a/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklist.java b/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklist.java new file mode 100644 index 0000000000..be69163841 --- /dev/null +++ b/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklist.java @@ -0,0 +1,35 @@ +package org.togetherjava.tjbot.config; + +import com.fasterxml.jackson.annotation.JsonCreator; + +import java.util.Set; + +/** + * Blacklist of features, use {@link FeatureBlacklist#isEnabled(T)} to test if a feature is enabled. + * If a feature is blacklisted, it won't be enabled by the bot, and so will be ignored. + * + * @param the type of the feature identifier + */ +public class FeatureBlacklist { + private final Set featureIdentifierBlacklist; + + /** + * Creates a feature blacklist + * + * @param featureIdentifierBlacklist a set of identifiers which are blacklisted + */ + @JsonCreator + public FeatureBlacklist(Set featureIdentifierBlacklist) { + this.featureIdentifierBlacklist = Set.copyOf(featureIdentifierBlacklist); + } + + /** + * Returns if a feature is enabled or not. + * + * @param featureId the identifier of the feature + * @return true if a feature is enabled, false otherwise + */ + public boolean isEnabled(T featureId) { + return !featureIdentifierBlacklist.contains(featureId); + } +} diff --git a/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklistConfig.java b/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklistConfig.java new file mode 100644 index 0000000000..231cbdb4f8 --- /dev/null +++ b/application/src/main/java/org/togetherjava/tjbot/config/FeatureBlacklistConfig.java @@ -0,0 +1,28 @@ +package org.togetherjava.tjbot.config; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * Configuration of the feature blacklist, any feature present here will be disabled. + * + * @param normal the normal features, which are present in + * {@link org.togetherjava.tjbot.features.Features} + * @param special the special features, which require special code + */ +public record FeatureBlacklistConfig( + @JsonProperty(value = "normal", required = true) FeatureBlacklist> normal, + @JsonProperty(value = "special", required = true) FeatureBlacklist special) { + + /** + * Creates a FeatureBlacklistConfig. + * + * @param normal the list of normal features, must be not null + * @param special the list of special features, must be not null + */ + public FeatureBlacklistConfig { + Objects.requireNonNull(normal); + Objects.requireNonNull(special); + } +} diff --git a/application/src/main/java/org/togetherjava/tjbot/features/Features.java b/application/src/main/java/org/togetherjava/tjbot/features/Features.java index e5186ad087..b98fc75d12 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/Features.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/Features.java @@ -3,6 +3,8 @@ import net.dv8tion.jda.api.JDA; import org.togetherjava.tjbot.config.Config; +import org.togetherjava.tjbot.config.FeatureBlacklist; +import org.togetherjava.tjbot.config.FeatureBlacklistConfig; import org.togetherjava.tjbot.db.Database; import org.togetherjava.tjbot.features.basic.PingCommand; import org.togetherjava.tjbot.features.basic.RoleSelectCommand; @@ -19,6 +21,7 @@ import org.togetherjava.tjbot.features.code.CodeMessageManualDetection; import org.togetherjava.tjbot.features.filesharing.FileSharingMessageListener; import org.togetherjava.tjbot.features.help.*; +import org.togetherjava.tjbot.features.jshell.JShellCommand; import org.togetherjava.tjbot.features.jshell.JShellEval; import org.togetherjava.tjbot.features.mathcommands.TeXCommand; import org.togetherjava.tjbot.features.mathcommands.wolframalpha.WolframAlphaCommand; @@ -73,6 +76,7 @@ private Features() { * @return a collection of all features */ public static Collection createFeatures(JDA jda, Database database, Config config) { + FeatureBlacklistConfig blacklistConfig = config.getFeatureBlacklistConfig(); JShellEval jshellEval = new JShellEval(config.getJshell()); TagSystem tagSystem = new TagSystem(database); @@ -80,7 +84,8 @@ public static Collection createFeatures(JDA jda, Database database, Con ModerationActionsStore actionsStore = new ModerationActionsStore(database); ModAuditLogWriter modAuditLogWriter = new ModAuditLogWriter(config); ScamHistoryStore scamHistoryStore = new ScamHistoryStore(database); - CodeMessageHandler codeMessageHandler = new CodeMessageHandler(jshellEval); + CodeMessageHandler codeMessageHandler = + new CodeMessageHandler(blacklistConfig.special(), jshellEval); ChatGptService chatGptService = new ChatGptService(config); HelpSystemHelper helpSystemHelper = new HelpSystemHelper(config, database, chatGptService); @@ -151,7 +156,9 @@ public static Collection createFeatures(JDA jda, Database database, Con features.add(new ReportCommand(config)); features.add(new BookmarksCommand(bookmarksSystem)); features.add(new ChatGptCommand(chatGptService)); - // features.add(new JShellCommand(jshellEval)); - return features; + features.add(new JShellCommand(jshellEval)); + + FeatureBlacklist> blacklist = blacklistConfig.normal(); + return features.stream().filter(f -> blacklist.isEnabled(f.getClass())).toList(); } } diff --git a/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java b/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java index f4d27e85d5..916cef8bb6 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java @@ -15,6 +15,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.togetherjava.tjbot.config.FeatureBlacklist; import org.togetherjava.tjbot.features.MessageReceiverAdapter; import org.togetherjava.tjbot.features.UserInteractionType; import org.togetherjava.tjbot.features.UserInteractor; @@ -30,6 +31,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Handles code in registered messages and offers code actions to the user, such as formatting their @@ -63,14 +65,18 @@ public final class CodeMessageHandler extends MessageReceiverAdapter implements /** * Creates a new instance. - * + * + * @param blacklist the feature blacklist, used to test if certain code actions should be + * disabled * @param jshellEval used to execute java code and build visual result */ - public CodeMessageHandler(JShellEval jshellEval) { + public CodeMessageHandler(FeatureBlacklist blacklist, JShellEval jshellEval) { componentIdInteractor = new ComponentIdInteractor(getInteractionType(), getName()); List codeActions = - List.of(new FormatCodeCommand()/* , new EvalCodeCommand(jshellEval) */); + Stream.of(new FormatCodeCommand(), new EvalCodeCommand(jshellEval)) + .filter(a -> blacklist.isEnabled(a.getClass().getSimpleName())) + .toList(); labelToCodeAction = codeActions.stream() .collect(Collectors.toMap(CodeAction::getLabel, Function.identity(), (x, y) -> y, From 5ba5835b0f2f0bd6532d71e33ccdecc2f389ef87 Mon Sep 17 00:00:00 2001 From: Daniel Tischner Date: Fri, 22 Sep 2023 09:25:14 +0200 Subject: [PATCH 13/18] hotfix feature_blacklist -> featureBlacklist --- application/config.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config.json.template b/application/config.json.template index 56a02ecc39..c625b3d212 100644 --- a/application/config.json.template +++ b/application/config.json.template @@ -102,7 +102,7 @@ "inactivateAfterDays": 90, "recentlyJoinedDays": 4 }, - "feature_blacklist": { + "featureBlacklist": { "normal": [ ], "special": [ From 233cb9d648513641bba35cbbb07b789ae2d34915 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:26:39 +0200 Subject: [PATCH 14/18] Bump com.google.cloud.tools.jib from 3.3.0 to 3.4.0 (#896) Bumps com.google.cloud.tools.jib from 3.3.0 to 3.4.0. --- updated-dependencies: - dependency-name: com.google.cloud.tools.jib dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- application/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/build.gradle b/application/build.gradle index c8ad29bf65..016e02a28b 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -6,7 +6,7 @@ buildscript { plugins { id 'application' - id 'com.google.cloud.tools.jib' version '3.3.0' + id 'com.google.cloud.tools.jib' version '3.4.0' id 'com.github.johnrengelman.shadow' version '8.1.0' id 'database-settings' } From 68deee0ab4c0eab70ba8ea37129693e99c7d9c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20Schweigh=C3=B6fer?= Date: Mon, 25 Sep 2023 09:03:44 +0200 Subject: [PATCH 15/18] Remove the use of the deprecated `packages` attribute (#894) --- application/src/main/resources/log4j2.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/resources/log4j2.xml b/application/src/main/resources/log4j2.xml index 3de21e9d65..417a7eaa6c 100644 --- a/application/src/main/resources/log4j2.xml +++ b/application/src/main/resources/log4j2.xml @@ -1,5 +1,5 @@ - + From 0d2f654540921a8149515e49f03d86927133e3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20Schweigh=C3=B6fer?= Date: Mon, 25 Sep 2023 09:05:28 +0200 Subject: [PATCH 16/18] Pin the correct message in questions thread (#893) --- .../help/HelpThreadCreatedListener.java | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java index 6bbf80eff7..210b279779 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCreatedListener.java @@ -9,15 +9,11 @@ import net.dv8tion.jda.api.events.channel.ChannelCreateEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.requests.RestAction; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.togetherjava.tjbot.features.EventReceiver; import java.time.Instant; import java.time.temporal.ChronoUnit; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** @@ -27,8 +23,6 @@ * user. */ public final class HelpThreadCreatedListener extends ListenerAdapter implements EventReceiver { - private static final Logger logger = LoggerFactory.getLogger(HelpThreadCreatedListener.class); - private static final ScheduledExecutorService SERVICE = Executors.newScheduledThreadPool(2); private final HelpSystemHelper helper; private final Cache threadIdToCreatedAtCache = Caffeine.newBuilder() @@ -74,20 +68,11 @@ private boolean wasThreadAlreadyHandled(long threadChannelId) { private void handleHelpThreadCreated(ThreadChannel threadChannel) { helper.writeHelpThreadToDatabase(threadChannel.getOwnerIdLong(), threadChannel); - Runnable createMessages = () -> { - try { - createMessages(threadChannel).queue(); - } catch (Exception e) { - logger.error( - "Unknown error while creating messages after help-thread ({}) creation", - threadChannel.getId(), e); - } - }; - // The creation is delayed, because otherwise it could be too fast and be executed // after Discord created the thread, but before Discord send OPs initial message. // Sending messages at that moment is not allowed. - SERVICE.schedule(createMessages, 5, TimeUnit.SECONDS); + createMessages(threadChannel).and(pinOriginalQuestion(threadChannel)) + .queueAfter(5, TimeUnit.SECONDS); } private RestAction createAIResponse(ThreadChannel threadChannel) { @@ -97,8 +82,12 @@ private RestAction createAIResponse(ThreadChannel threadChannel) { message -> helper.constructChatGptAttempt(threadChannel, message.getContentRaw())); } + private RestAction pinOriginalQuestion(ThreadChannel threadChannel) { + return threadChannel.retrieveMessageById(threadChannel.getIdLong()).flatMap(Message::pin); + } + private RestAction createMessages(ThreadChannel threadChannel) { - return sendHelperHeadsUp(threadChannel).flatMap(Message::pin) + return sendHelperHeadsUp(threadChannel) .flatMap(any -> helper.sendExplanationMessage(threadChannel)) .flatMap(any -> createAIResponse(threadChannel)); } From 68b08eda54e419cc8aa1f1854ef81da430176d21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 08:55:56 +0200 Subject: [PATCH 17/18] Bump org.sonarqube from 4.3.0.3225 to 4.4.0.3356 (#904) Bumps org.sonarqube from 4.3.0.3225 to 4.4.0.3356. --- updated-dependencies: - dependency-name: org.sonarqube dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1e648c367b..155304eeff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id "com.diffplug.spotless" version "6.21.0" - id "org.sonarqube" version "4.3.0.3225" + id "org.sonarqube" version "4.4.0.3356" id "name.remal.sonarlint" version "3.3.0" } From 6b9f572020c0418cff3af98d5cb5c6df758c875a Mon Sep 17 00:00:00 2001 From: java-coding-prodigy <85149944+java-coding-prodigy@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:36 +0530 Subject: [PATCH 18/18] Update Workflows (#903) * Update CodeQL * oopsies --- .github/workflows/code-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 94cbba8bf6..f8d4cea622 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -72,7 +72,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -83,7 +83,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 + # uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -95,4 +95,4 @@ jobs: ./gradlew build - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2