diff options
author | msg-programs <msgdoesstuff@gmail.com> | 2023-09-08 09:54:47 +0200 |
---|---|---|
committer | msg-programs <msgdoesstuff@gmail.com> | 2023-09-08 09:54:47 +0200 |
commit | 7df2a590d4b0079f65ef639315d04f63c2f754a7 (patch) | |
tree | fb2b0594a7e0b397b8f5afccdfa8ae7409edb9f8 /.github/workflows | |
parent | b153e75818b5058df9334953d5924c2c82598719 (diff) | |
parent | 9c7bf54123f366ad90bfafe81e973b731fd6b5b3 (diff) | |
download | Skyblocker-7df2a590d4b0079f65ef639315d04f63c2f754a7.tar.gz Skyblocker-7df2a590d4b0079f65ef639315d04f63c2f754a7.tar.bz2 Skyblocker-7df2a590d4b0079f65ef639315d04f63c2f754a7.zip |
Merge branch 'master' of https://github.com/SkyblockerMod/Skyblocker into readme-fixes
Pull upstream updates into branch
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/webhook_translate.yml | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/.github/workflows/webhook_translate.yml b/.github/workflows/webhook_translate.yml index 6d072634..00534eef 100644 --- a/.github/workflows/webhook_translate.yml +++ b/.github/workflows/webhook_translate.yml @@ -12,11 +12,47 @@ jobs: if: github.repository_owner == 'SkyblockerMod' runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} + + - name: Install jd + run: go install github.com/josephburnett/jd@latest + - name: Translate notification shell: bash run: | - OUTPUT=" - <@&1134566053138145330> - New Strings available at https://translate.hysky.de/projects/Skyblocker/skyblocker" - - curl -H "Content-Type: application/json" -d '{"content":"'"${OUTPUT//$'\n'/\\n}"'", "flags": 4}' "${{ secrets.DISCORD_TRANSLATE_WEBHOOK }}" + OUTPUT=$(go run github.com/josephburnett/jd@latest <(git show HEAD^:src/main/resources/assets/skyblocker/lang/en_us.json) <(git show HEAD:src/main/resources/assets/skyblocker/lang/en_us.json) || true) + OUTPUT=$(echo "$OUTPUT" | sed 's/"/\\"/g') + OUTPUT="\`\`\`diff + $OUTPUT + \`\`\`" + + JSON_PAYLOAD='{ + "content": "<@&1134566053138145330>", + "embeds": [ + { + "title": "Something Changed (Click me)", + "description": "'"${OUTPUT//$'\n'/\\n}"'", + "url": "https://translate.hysky.de/projects/Skyblocker/skyblocker", + "color": 5808639, + "image": { + "url": "https://translate.hysky.de/widgets/Skyblocker/-/skyblocker/88x31-grey.png" + } + } + ], + "attachments": [] + }' + + curl -H "Content-Type: application/json" --data-binary "$JSON_PAYLOAD" "${{ secrets.DISCORD_TRANSLATE_WEBHOOK }}" |