aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/webhook_translate.yml
diff options
context:
space:
mode:
authorYasin <LifeIsAParadox@users.noreply.github.com>2024-04-09 21:55:09 +0200
committerGitHub <noreply@github.com>2024-04-09 15:55:09 -0400
commitec2672d95e0727e75f628c29d86eb43ee7e67e53 (patch)
tree64ab211ea9edbf703083397a0a59dfcc8d685740 /.github/workflows/webhook_translate.yml
parentb3623837bda701610868552005a25a5e5c148b8f (diff)
downloadSkyblocker-ec2672d95e0727e75f628c29d86eb43ee7e67e53.tar.gz
Skyblocker-ec2672d95e0727e75f628c29d86eb43ee7e67e53.tar.bz2
Skyblocker-ec2672d95e0727e75f628c29d86eb43ee7e67e53.zip
fix translate workflow (#639)
fix
Diffstat (limited to '.github/workflows/webhook_translate.yml')
-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