From 77afba04b38b436c61e4b8fd4e5b6fa0d1c529e6 Mon Sep 17 00:00:00 2001 From: Translator workflow Date: Thu, 1 Jun 2023 14:34:11 +0200 Subject: [PATCH] f --- .github/workflows/translate_es.yml | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/translate_es.yml b/.github/workflows/translate_es.yml index a477caa0..00e701f3 100644 --- a/.github/workflows/translate_es.yml +++ b/.github/workflows/translate_es.yml @@ -25,30 +25,6 @@ jobs: with: fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - name: Run translation script on changed files - run: | - # Start a subshell with a timeout (5h) - - echo "Starting translations" - echo "Commit: 0afe4e4475ddd0e31b7b8957df1e0e9bb275b731" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff-tree --no-commit-id --name-only -r "0afe4e4475ddd0e31b7b8957df1e0e9bb275b731" - echo "===========" - git diff-tree --no-commit-id --name-only -r "0afe4e4475ddd0e31b7b8957df1e0e9bb275b731" | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo $file - PATHS="$file , $PATHS" - else - echo "Skipping $file" - fi - done - - echo "Translating $PATHS" - - name: Set up Python uses: actions/setup-python@v2 with: @@ -89,14 +65,14 @@ jobs: # Run the translation script on each changed file git diff-tree --no-commit-id --name-only -r "0afe4e4475ddd0e31b7b8957df1e0e9bb275b731" | grep -v "SUMMARY.md" | while read -r file; do if echo "$file" | grep -qE '\.md$'; then - PATHS="$file , $PATHS" + echo -n "$file , " >> /tmp/file_paths.txt else echo "Skipping $file" fi done echo "Translating $PATHS" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$PATHS" + python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" - name: Commit and push changes run: |