aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/webhook_translate.yml14
1 files changed, 10 insertions, 4 deletions
diff --git a/.github/workflows/webhook_translate.yml b/.github/workflows/webhook_translate.yml
index 5d1208fa..1998ee73 100644
--- a/.github/workflows/webhook_translate.yml
+++ b/.github/workflows/webhook_translate.yml
@@ -15,10 +15,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
- fetch-depth: 2
+ fetch-depth: 0
- name: Set up Go
- uses: actions/setup-go@v4
+ uses: actions/setup-go@v5
with:
go-version: '1.20'
@@ -39,13 +39,14 @@ jobs:
OUTPUT="\`\`\`diff
$OUTPUT
\`\`\`"
+ OUTPUT=$(jq -Rn --arg str "$OUTPUT" '$str' | sed -E "s|^(['\"])(.*)\1$|\2|g")
JSON_PAYLOAD='{
"content": "<@&1134566053138145330>",
"embeds": [
{
"title": "Something Changed (Click me)",
- "description": "'"${OUTPUT//$'\n'/\\n}"'",
+ "description": "'"${OUTPUT}"'",
"url": "https://translate.hysky.de/projects/Skyblocker/skyblocker",
"color": 5808639,
"image": {
@@ -56,4 +57,9 @@ jobs:
"attachments": []
}'
- curl -H "Content-Type: application/json" --data-binary "$JSON_PAYLOAD" "${{ secrets.DISCORD_TRANSLATE_WEBHOOK }}"
+ if echo "$JSON_PAYLOAD" | jq . &>/dev/null; then
+ curl -H "Content-Type: application/json" --data-binary "$JSON_PAYLOAD" "${{ secrets.DISCORD_TRANSLATE_WEBHOOK }}"
+ else
+ echo "Error:"
+ echo "$JSON_PAYLOAD"
+ fi \ No newline at end of file