f
This commit is contained in:
parent
6434b0a321
commit
77afba04b3
28
.github/workflows/translate_es.yml
vendored
28
.github/workflows/translate_es.yml
vendored
@ -25,30 +25,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 #Needed to download everything to be able to access the master & language branches
|
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
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
@ -89,14 +65,14 @@ jobs:
|
|||||||
# 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"
|
echo -n "$file , " >> /tmp/file_paths.txt
|
||||||
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 "$(cat /tmp/file_paths.txt)"
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
run: |
|
run: |
|
||||||
|
Loading…
Reference in New Issue
Block a user