diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index ab07de32..85bb07df 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -40,19 +40,21 @@ jobs: with: fetch-depth: 0 - name: Prepare Profanity Check + id: prep run: | sudo apt-get install -y xmlstarlet pip3 install alt-profanity-check chmod +x ./scripts/checkProfanity.py chmod +x ./scripts/generateFilelist.sh - ./scripts/generateFilelist.sh ${{ github.event.pull_request.commits }} ${{needs.string-change-verification.outputs.files}} + TRANSLATIONS=$(./scripts/generateFilelist.sh ${{ github.event.pull_request.commits }} ${{needs.string-change-verification.outputs.files}}) + echo "TRANSLATIONS=$TRANSLATIONS" >> $GITHUB_OUTPUT shell: sh - uses: fabasoad/translation-action@main - id: google-step + id: google-translate with: provider: google lang: auto-en - source: "Wir müssen Alarme und Wecker anlegen, sodass die Synchronisierungen pünktlich starten. Wenn diese Berechtigungen nicht gegeben ist, werden Synchronisierungen nicht funktionieren." + source: ${{ steps.prep.outputs.TRANSLATIONS }} - name: Print the result - run: echo "Translation is '${{ steps.google-step.outputs.text }}'" + run: echo "Translation is '${{ steps.google-translate.outputs.text }}'" shell: sh diff --git a/scripts/generateFilelist.sh b/scripts/generateFilelist.sh index 4dd2f7e4..6808aa15 100755 --- a/scripts/generateFilelist.sh +++ b/scripts/generateFilelist.sh @@ -1,8 +1,8 @@ #!/bin/bash +if [ "$#" -ne 2 ]; then + echo "Only pass the amount of commits and one translation file!" + exit 1 +fi -echo "$@" -echo "$1" -echo "$2" -echo "$3" -git diff -U0 HEAD~$1 | grep -E "^\+" | grep -v +++ \ No newline at end of file +git diff -U0 HEAD~$1 ${@:2}| grep -E "^\+" | grep -v +++ | cut -c 2- | sed 's/^[ \t]*\(.*$\)/\1/'