From 969eaf92bcc9ae01f673224313abf308ab9d32ac Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 26 Jul 2023 23:33:01 +0200 Subject: [PATCH 1/2] Add project name to reportConfig --- build.gradle | 2 +- buildSrc/src/main/java/fr/altarik/ReportDiscord.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 2278137..047bbbe 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ String webhookId = getEnv("DISCORD_PUB_ID", local.getProperty("discord_pub_id")) String webhookToken = getEnv("DISCORD_PUB_TOKEN", local.getProperty("discord_pub_token")) String repoUrl = "https://repo.altarik.fr/#/" + (project.version.endsWith('SNAPSHOT') ? 'snapshots/' : 'releases/') + project.group.replace(".", "/") + "/" + project.rootProject.name + "/" + project.version -var reportConfig = new ReportDiscord.ReportData("https://discord.com/api/", webhookId, webhookToken, "Update " + project.version + " has been published", repoUrl); +var reportConfig = new ReportDiscord.ReportData("https://discord.com/api/", webhookId, webhookToken, project.rootProject.name, "Update " + project.version + " has been published", repoUrl); allprojects { apply plugin: 'maven-publish' diff --git a/buildSrc/src/main/java/fr/altarik/ReportDiscord.java b/buildSrc/src/main/java/fr/altarik/ReportDiscord.java index 15ad0c1..3879bbb 100644 --- a/buildSrc/src/main/java/fr/altarik/ReportDiscord.java +++ b/buildSrc/src/main/java/fr/altarik/ReportDiscord.java @@ -26,7 +26,8 @@ public abstract class ReportDiscord extends DefaultTask { { "embeds": [ { - "title": "A new update for Toolbox is available", + "title": "A new update of\s""" + data.projectName() + """ + is available", "description":\s""" + "\"" + message + "\"" + """ , "url":\s""" + "\"" + data.url() + "\"" + """ @@ -48,7 +49,7 @@ public abstract class ReportDiscord extends DefaultTask { } } - public record ReportData(String baseUrl, String webhookId, String webhookToken, String message, String url) { + public record ReportData(String baseUrl, String webhookId, String webhookToken, String projectName, String message, String url) { } -- 2.39.5 From c459bf939725ae24fafdf64020f2e53b7eca8ec0 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 26 Jul 2023 23:36:01 +0200 Subject: [PATCH 2/2] Trying to fix report discord task --- .gitea/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 61e0ee7..5b4c10e 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -13,6 +13,8 @@ on: env: REPO_USERNAME: Altarik REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }} + DISCORD_PUB_ID: ${{ secrets.DISCORD_PUB_ID }} + DISCORD_PUB_TOKEN: ${{ secrets.DISCORD_PUB_TOKEN }} jobs: build: -- 2.39.5