diff options
author | Yasin <LifeIsAParadox@users.noreply.github.com> | 2024-05-09 22:28:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 22:28:47 +0200 |
commit | 21253c3b4e37ce07198a6e736a2b8a403d9661af (patch) | |
tree | 6cf569e6c1be5a1fa622115a4a422ddbd3d43d58 /.github/workflows/webhook_translate.yml | |
parent | 4a4234d7c9d4f038d4fa418fb15ef24ce3fcc501 (diff) | |
parent | 14302bb348aff30c33a27f43a8b6c017f2fb829e (diff) | |
download | Skyblocker-21253c3b4e37ce07198a6e736a2b8a403d9661af.tar.gz Skyblocker-21253c3b4e37ce07198a6e736a2b8a403d9661af.tar.bz2 Skyblocker-21253c3b4e37ce07198a6e736a2b8a403d9661af.zip |
Merge pull request #697 from LifeIsAParadox/ultimate-config-reconfiguration
Ultimate config reconfiguration
Diffstat (limited to '.github/workflows/webhook_translate.yml')
-rw-r--r-- | .github/workflows/webhook_translate.yml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/.github/workflows/webhook_translate.yml b/.github/workflows/webhook_translate.yml index 85ed7c3c..9826110c 100644 --- a/.github/workflows/webhook_translate.yml +++ b/.github/workflows/webhook_translate.yml @@ -34,6 +34,37 @@ jobs: shell: bash run: | 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) + + MAX_LENGTH=4070 + + if [ "${#OUTPUT}" -gt "$MAX_LENGTH" ]; then + + OUTPUT="${OUTPUT:0:$MAX_LENGTH}" + + LAST_INDEX=-1 + for (( i=${#OUTPUT}-1; i>=0; i-- )); do + if [[ "${OUTPUT:$i:1}" =~ [-+@] ]]; then + LAST_INDEX=$i + break + fi + done + + if [[ $LAST_INDEX -ne -1 && "${OUTPUT:$LAST_INDEX:1}" =~ [-+] ]]; then + + for (( i=LAST_INDEX-1; i>=0; i-- )); do + if [[ "${OUTPUT:$i:1}" == "@" ]]; then + OUTPUT="${OUTPUT:0:i}" + break + fi + done + else + + OUTPUT="${OUTPUT:0:LAST_INDEX}" + fi + fi + + OUTPUT+="..." + OUTPUT="\`\`\`diff $OUTPUT \`\`\`" |