From f96faa4cf6352ddf2242165588c34642888a2f2f Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 1 Oct 2026 16:13:54 +0200 Subject: [PATCH 1/5] chore: Remove WebHook generation from Onboarding message --- src/main/kotlin/com/wire/github/EventsHandler.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index d150cca..f9baac9 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -50,10 +50,8 @@ class EventsHandler : WireEventsHandlerSuspending() { "conversationId: ${conversation.id}" ) usageMetrics.onAppAddedToConversation() - val webhookSetup = commandHandler.webhookHelp(conversationId = conversation.id) val message = buildString { appendLine(WELCOME_TEXT) - appendLine(webhookSetup) appendLine() append("Use `${GitHubCommandHandler.HELP_COMMAND}` to see all available commands.") } From cca3a9482d160dbd9188647375351cffb5d632c3 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 1 Oct 2026 17:47:36 +0200 Subject: [PATCH 2/5] chore: Remove WebHook generation from Onboarding message * Update help command --- .../kotlin/com/wire/github/EventsHandler.kt | 2 +- .../com/wire/github/GitHubCommandHandler.kt | 24 ++++++------- .../wire/github/GitHubCommandHandlerTest.kt | 36 ------------------- 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index f9baac9..7c52803 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -53,7 +53,7 @@ class EventsHandler : WireEventsHandlerSuspending() { val message = buildString { appendLine(WELCOME_TEXT) appendLine() - append("Use `${GitHubCommandHandler.HELP_COMMAND}` to see all available commands.") + append(GitHubCommandHandler.HELP_COMMANDS) } manager.sendMessage( diff --git a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt index 6aea5ef..88c6a6e 100644 --- a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt +++ b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt @@ -22,7 +22,6 @@ internal class GitHubCommandHandler( ): String? = when (command.lowercase()) { HELP_COMMAND -> trackedHelp(help()) - TOKENS_COMMAND -> tokens(conversationId) WEBHOOK_HELP_COMMAND -> trackedHelp(webhookHelp(conversationId)) ACTIONS_HELP_COMMAND -> trackedHelp(actionsHelp(conversationId)) else -> null @@ -30,16 +29,8 @@ internal class GitHubCommandHandler( fun help(): String = "GitHub App supports repository webhooks and workflow-authored Actions notifications.\n\n" + - "Available commands:\n" + - "- `$TOKENS_COMMAND` — show or create this conversation's credentials\n" + - "- `$WEBHOOK_HELP_COMMAND` — configure GitHub repository webhooks\n" + - "- `$ACTIONS_HELP_COMMAND` — send custom messages from GitHub Actions" + HELP_COMMANDS - private fun tokens(conversationId: QualifiedId): String = - "Conversation credentials:\n\n" + - "GitHub webhook secret:\n`${getOrCreateSecret(conversationId)}`\n\n" + - "GitHub Actions token:\n`${getOrCreateActionsToken(conversationId)}`\n\n" + - "Store these values as secrets. Do not print them in workflow logs." fun webhookHelp(conversationId: QualifiedId): String { val webhookUrl = "$normalizedHost/${conversationId.id}/${conversationId.domain}" @@ -56,10 +47,11 @@ internal class GitHubCommandHandler( private fun actionsHelp(conversationId: QualifiedId): String { val actionsUrl = "$normalizedHost/actions/${conversationId.id}/${conversationId.domain}" return "GitHub Actions notification setup:\n\n" + - "Store this URL as `WIRE_WEBHOOK_URL`:\n$actionsUrl\n\n" + - "Store this token as `WIRE_ACTIONS_TOKEN`:\n" + + "1. Open **Settings / Secrets and Variables / Actions / New repository secret\n" + + "1.1 Store this URL as `WIRE_WEBHOOK_URL`: $actionsUrl\n" + + "1.2 Store this token as `WIRE_ACTIONS_TOKEN`: " + "${getOrCreateActionsToken(conversationId)}\n\n" + - "Use the reusable action:\n\n" + + "2. Use the reusable action into your `.yml`/`.yaml` files:\n\n" + "```yaml\n" + "uses: wireapp/github-app/.github/actions/notify-wire@v1\n" + "with:\n" + @@ -88,8 +80,12 @@ internal class GitHubCommandHandler( companion object { const val HELP_COMMAND = "/github help" - const val TOKENS_COMMAND = "/github tokens" const val WEBHOOK_HELP_COMMAND = "/github webhook help" const val ACTIONS_HELP_COMMAND = "/github actions help" + const val HELP_COMMANDS = + "Available commands:\n" + + "- `$WEBHOOK_HELP_COMMAND` - configure GitHub repository webhooks\n" + + "- `$ACTIONS_HELP_COMMAND` - send custom messages from GitHub Actions\n" + + "- `$HELP_COMMAND` - Show this help message" } } diff --git a/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt b/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt index 62b2f5d..218622c 100644 --- a/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt +++ b/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt @@ -28,47 +28,11 @@ class GitHubCommandHandlerTest { fun `help lists all available commands`() { val response = handler.response("/GITHUB HELP", CONVERSATION_ID) - assertContains(response.orEmpty(), GitHubCommandHandler.TOKENS_COMMAND) assertContains(response.orEmpty(), GitHubCommandHandler.WEBHOOK_HELP_COMMAND) assertContains(response.orEmpty(), GitHubCommandHandler.ACTIONS_HELP_COMMAND) verify(exactly = 1) { usageMetrics.onHelpCommand() } } - @Test - fun `tokens returns existing webhook secret and Actions token`() { - every { storage.get(CONVERSATION_ID.toStorageKey()) } returns EXISTING_SECRET - every { - storage.get(CONVERSATION_ID.toActionsTokenStorageKey()) - } returns EXISTING_ACTIONS_TOKEN - - val response = handler.response(GitHubCommandHandler.TOKENS_COMMAND, CONVERSATION_ID) - - assertContains(response.orEmpty(), EXISTING_SECRET) - assertContains(response.orEmpty(), EXISTING_ACTIONS_TOKEN) - verify(exactly = 0) { storage.set(any(), any()) } - verify(exactly = 0) { usageMetrics.onHelpCommand() } - } - - @Test - fun `tokens creates and stores both credentials when they are missing`() { - every { storage.get(CONVERSATION_ID.toStorageKey()) } returns null - every { storage.set(CONVERSATION_ID.toStorageKey(), GENERATED_SECRET) } returns "OK" - every { storage.get(CONVERSATION_ID.toActionsTokenStorageKey()) } returns null - every { - storage.set(CONVERSATION_ID.toActionsTokenStorageKey(), GENERATED_ACTIONS_TOKEN) - } returns "OK" - - val response = handler.response(GitHubCommandHandler.TOKENS_COMMAND, CONVERSATION_ID) - - assertContains(response.orEmpty(), GENERATED_SECRET) - assertContains(response.orEmpty(), GENERATED_ACTIONS_TOKEN) - verify(exactly = 1) { storage.set(CONVERSATION_ID.toStorageKey(), GENERATED_SECRET) } - verify(exactly = 1) { - storage.set(CONVERSATION_ID.toActionsTokenStorageKey(), GENERATED_ACTIONS_TOKEN) - } - verify(exactly = 0) { usageMetrics.onHelpCommand() } - } - @Test fun `webhook help includes webhook URL and token`() { every { storage.get(CONVERSATION_ID.toStorageKey()) } returns EXISTING_SECRET From 79b6a4f0487490d58a5152b38390bbfd9d358239 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 1 Oct 2026 17:47:36 +0200 Subject: [PATCH 3/5] chore: Remove WebHook generation from Onboarding message * Update help command --- .../kotlin/com/wire/github/EventsHandler.kt | 2 +- .../com/wire/github/GitHubCommandHandler.kt | 25 ++++++------- .../wire/github/GitHubCommandHandlerTest.kt | 36 ------------------- 3 files changed, 11 insertions(+), 52 deletions(-) diff --git a/src/main/kotlin/com/wire/github/EventsHandler.kt b/src/main/kotlin/com/wire/github/EventsHandler.kt index f9baac9..7c52803 100644 --- a/src/main/kotlin/com/wire/github/EventsHandler.kt +++ b/src/main/kotlin/com/wire/github/EventsHandler.kt @@ -53,7 +53,7 @@ class EventsHandler : WireEventsHandlerSuspending() { val message = buildString { appendLine(WELCOME_TEXT) appendLine() - append("Use `${GitHubCommandHandler.HELP_COMMAND}` to see all available commands.") + append(GitHubCommandHandler.HELP_COMMANDS) } manager.sendMessage( diff --git a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt index 6aea5ef..3c4b6e2 100644 --- a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt +++ b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt @@ -22,7 +22,6 @@ internal class GitHubCommandHandler( ): String? = when (command.lowercase()) { HELP_COMMAND -> trackedHelp(help()) - TOKENS_COMMAND -> tokens(conversationId) WEBHOOK_HELP_COMMAND -> trackedHelp(webhookHelp(conversationId)) ACTIONS_HELP_COMMAND -> trackedHelp(actionsHelp(conversationId)) else -> null @@ -30,16 +29,7 @@ internal class GitHubCommandHandler( fun help(): String = "GitHub App supports repository webhooks and workflow-authored Actions notifications.\n\n" + - "Available commands:\n" + - "- `$TOKENS_COMMAND` — show or create this conversation's credentials\n" + - "- `$WEBHOOK_HELP_COMMAND` — configure GitHub repository webhooks\n" + - "- `$ACTIONS_HELP_COMMAND` — send custom messages from GitHub Actions" - - private fun tokens(conversationId: QualifiedId): String = - "Conversation credentials:\n\n" + - "GitHub webhook secret:\n`${getOrCreateSecret(conversationId)}`\n\n" + - "GitHub Actions token:\n`${getOrCreateActionsToken(conversationId)}`\n\n" + - "Store these values as secrets. Do not print them in workflow logs." + HELP_COMMANDS fun webhookHelp(conversationId: QualifiedId): String { val webhookUrl = "$normalizedHost/${conversationId.id}/${conversationId.domain}" @@ -56,10 +46,11 @@ internal class GitHubCommandHandler( private fun actionsHelp(conversationId: QualifiedId): String { val actionsUrl = "$normalizedHost/actions/${conversationId.id}/${conversationId.domain}" return "GitHub Actions notification setup:\n\n" + - "Store this URL as `WIRE_WEBHOOK_URL`:\n$actionsUrl\n\n" + - "Store this token as `WIRE_ACTIONS_TOKEN`:\n" + + "1. Open **Settings / Secrets and Variables / Actions / New repository secret\n" + + "1.1 Store this URL as `WIRE_WEBHOOK_URL`: $actionsUrl\n" + + "1.2 Store this token as `WIRE_ACTIONS_TOKEN`: " + "${getOrCreateActionsToken(conversationId)}\n\n" + - "Use the reusable action:\n\n" + + "2. Use the reusable action into your `.yml`/`.yaml` files:\n\n" + "```yaml\n" + "uses: wireapp/github-app/.github/actions/notify-wire@v1\n" + "with:\n" + @@ -88,8 +79,12 @@ internal class GitHubCommandHandler( companion object { const val HELP_COMMAND = "/github help" - const val TOKENS_COMMAND = "/github tokens" const val WEBHOOK_HELP_COMMAND = "/github webhook help" const val ACTIONS_HELP_COMMAND = "/github actions help" + const val HELP_COMMANDS = + "Available commands:\n" + + "- `$WEBHOOK_HELP_COMMAND` - configure GitHub repository webhooks\n" + + "- `$ACTIONS_HELP_COMMAND` - send custom messages from GitHub Actions\n" + + "- `$HELP_COMMAND` - Show this help message" } } diff --git a/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt b/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt index 62b2f5d..218622c 100644 --- a/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt +++ b/src/test/kotlin/com/wire/github/GitHubCommandHandlerTest.kt @@ -28,47 +28,11 @@ class GitHubCommandHandlerTest { fun `help lists all available commands`() { val response = handler.response("/GITHUB HELP", CONVERSATION_ID) - assertContains(response.orEmpty(), GitHubCommandHandler.TOKENS_COMMAND) assertContains(response.orEmpty(), GitHubCommandHandler.WEBHOOK_HELP_COMMAND) assertContains(response.orEmpty(), GitHubCommandHandler.ACTIONS_HELP_COMMAND) verify(exactly = 1) { usageMetrics.onHelpCommand() } } - @Test - fun `tokens returns existing webhook secret and Actions token`() { - every { storage.get(CONVERSATION_ID.toStorageKey()) } returns EXISTING_SECRET - every { - storage.get(CONVERSATION_ID.toActionsTokenStorageKey()) - } returns EXISTING_ACTIONS_TOKEN - - val response = handler.response(GitHubCommandHandler.TOKENS_COMMAND, CONVERSATION_ID) - - assertContains(response.orEmpty(), EXISTING_SECRET) - assertContains(response.orEmpty(), EXISTING_ACTIONS_TOKEN) - verify(exactly = 0) { storage.set(any(), any()) } - verify(exactly = 0) { usageMetrics.onHelpCommand() } - } - - @Test - fun `tokens creates and stores both credentials when they are missing`() { - every { storage.get(CONVERSATION_ID.toStorageKey()) } returns null - every { storage.set(CONVERSATION_ID.toStorageKey(), GENERATED_SECRET) } returns "OK" - every { storage.get(CONVERSATION_ID.toActionsTokenStorageKey()) } returns null - every { - storage.set(CONVERSATION_ID.toActionsTokenStorageKey(), GENERATED_ACTIONS_TOKEN) - } returns "OK" - - val response = handler.response(GitHubCommandHandler.TOKENS_COMMAND, CONVERSATION_ID) - - assertContains(response.orEmpty(), GENERATED_SECRET) - assertContains(response.orEmpty(), GENERATED_ACTIONS_TOKEN) - verify(exactly = 1) { storage.set(CONVERSATION_ID.toStorageKey(), GENERATED_SECRET) } - verify(exactly = 1) { - storage.set(CONVERSATION_ID.toActionsTokenStorageKey(), GENERATED_ACTIONS_TOKEN) - } - verify(exactly = 0) { usageMetrics.onHelpCommand() } - } - @Test fun `webhook help includes webhook URL and token`() { every { storage.get(CONVERSATION_ID.toStorageKey()) } returns EXISTING_SECRET From 7daf4e7fcf6d5c3ed0536eef49edf3a0e9813193 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 1 Oct 2026 17:54:03 +0200 Subject: [PATCH 4/5] chore: Remove WebHook generation from Onboarding message * Add removed block code for actions token value --- src/main/kotlin/com/wire/github/GitHubCommandHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt index 3c4b6e2..9e702d1 100644 --- a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt +++ b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt @@ -49,7 +49,7 @@ internal class GitHubCommandHandler( "1. Open **Settings / Secrets and Variables / Actions / New repository secret\n" + "1.1 Store this URL as `WIRE_WEBHOOK_URL`: $actionsUrl\n" + "1.2 Store this token as `WIRE_ACTIONS_TOKEN`: " + - "${getOrCreateActionsToken(conversationId)}\n\n" + + "`${getOrCreateActionsToken(conversationId)}`\n\n" + "2. Use the reusable action into your `.yml`/`.yaml` files:\n\n" + "```yaml\n" + "uses: wireapp/github-app/.github/actions/notify-wire@v1\n" + From 7220650184ec005ead166c6ca71b950baa272dd5 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 1 Oct 2026 18:04:23 +0200 Subject: [PATCH 5/5] chore: Remove WebHook generation from Onboarding message * Adjust actions help message --- src/main/kotlin/com/wire/github/GitHubCommandHandler.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt index 9e702d1..6ff7118 100644 --- a/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt +++ b/src/main/kotlin/com/wire/github/GitHubCommandHandler.kt @@ -46,11 +46,11 @@ internal class GitHubCommandHandler( private fun actionsHelp(conversationId: QualifiedId): String { val actionsUrl = "$normalizedHost/actions/${conversationId.id}/${conversationId.domain}" return "GitHub Actions notification setup:\n\n" + - "1. Open **Settings / Secrets and Variables / Actions / New repository secret\n" + - "1.1 Store this URL as `WIRE_WEBHOOK_URL`: $actionsUrl\n" + - "1.2 Store this token as `WIRE_ACTIONS_TOKEN`: " + + "1. Open **Settings / Secrets and Variables / Actions / New repository secret**\n" + + "1.1 Store this URL as **WIRE_WEBHOOK_URL**:\n$actionsUrl\n" + + "1.2 Store this token as **WIRE_ACTIONS_TOKEN**:\n" + "`${getOrCreateActionsToken(conversationId)}`\n\n" + - "2. Use the reusable action into your `.yml`/`.yaml` files:\n\n" + + "2. Use the reusable action into your **.yml**/**.yaml** files:\n\n" + "```yaml\n" + "uses: wireapp/github-app/.github/actions/notify-wire@v1\n" + "with:\n" +