Add project name to reportConfig
All checks were successful
/ build (17, ubuntu-latest) (push) Successful in 6m53s
/ deploy (17, ubuntu-latest) (push) Has been skipped

This commit is contained in:
Quentin Legot 2023-07-26 23:33:01 +02:00
parent bb9ae4d59b
commit 969eaf92bc
2 changed files with 4 additions and 3 deletions

View File

@ -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 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 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 { allprojects {
apply plugin: 'maven-publish' apply plugin: 'maven-publish'

View File

@ -26,7 +26,8 @@ public abstract class ReportDiscord extends DefaultTask {
{ {
"embeds": [ "embeds": [
{ {
"title": "A new update for Toolbox is available", "title": "A new update of\s""" + data.projectName() + """
is available",
"description":\s""" + "\"" + message + "\"" + """ "description":\s""" + "\"" + message + "\"" + """
, ,
"url":\s""" + "\"" + data.url() + "\"" + """ "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) {
} }