Only post the webhook once

This commit is contained in:
Jared 2022-04-04 22:13:25 +02:00
parent a4a9f21602
commit ef40b86ede
No known key found for this signature in database
GPG key ID: DB3BA3B9088A1BDF

View file

@ -312,16 +312,22 @@ def getGitChangelog = { ->
task sendWebhook {
if (System.getenv('discordWebhook') == null || System.getenv("BUILD_URL") == null) {
println "Cannot send the webhook without the webhook url or the build url"
return
doLast {
try {
if (System.getenv('discordWebhook') == null || System.getenv("BUILD_URL") == null) {
println "Cannot send the webhook without the webhook url or the build url"
return
}
def webhook = new Webhook(System.getenv('discordWebhook'), 'HexMod Patreon Gradle')
def message = new Message()
message.setUsername("Patreon early access")
message.setContent("New HexMod release! Download it here: ${System.getenv("BUILD_URL")}\nChangelog:\n${getGitChangelog()}")
webhook.sendMessage(message)
} catch (ignored) {
project.logger.error("Failed to push Discord webhook.")
}
}
def webhook = new Webhook(System.getenv('discordWebhook'), 'HexMod Patreon Gradle')
def message = new Message()
message.setUsername("Patreon early access")
message.setContent("New HexMod release! Download it here: ${System.getenv("BUILD_URL")}\nChangelog:\n${getGitChangelog()}")
webhook.sendMessage(message)
}