This commit is contained in:
Translator workflow 2023-06-01 14:26:17 +02:00
parent 85ab478162
commit 3e97eea48e

View File

@ -55,25 +55,24 @@ jobs:
- name: Run translation script on changed files - name: Run translation script on changed files
run: | run: |
# Start a subshell with a timeout (5h) # Start a subshell with a timeout (5h)
timeout 18000s bash << 'EOF'
echo "Starting translations" echo "Starting translations"
echo "Commit: 0afe4e4475ddd0e31b7b8957df1e0e9bb275b731" echo "Commit: 0afe4e4475ddd0e31b7b8957df1e0e9bb275b731"
# Export the OpenAI API key as an environment variable # Export the OpenAI API key as an environment variable
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Run the translation script on each changed file # 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 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 if echo "$file" | grep -qE '\.md$'; then
PATHS="$file , $PATHS" PATHS="$file , $PATHS"
else else
echo "Skipping $file" echo "Skipping $file"
fi fi
done done
echo "Translating $PATHS" 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 "$PATHS"
EOF
- name: Commit and push changes - name: Commit and push changes
run: | run: |