mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
f
This commit is contained in:
parent
20c36ad7a4
commit
78775e0737
41
.github/workflows/translate_es.yml
vendored
41
.github/workflows/translate_es.yml
vendored
@ -34,6 +34,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Update and download scripts
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
mkdir scripts
|
||||||
|
cd scripts
|
||||||
|
wget -O get_and_save_refs.py https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/get_and_save_refs.py
|
||||||
|
wget -O compare_and_fix_refs.py https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/compare_and_fix_refs.py
|
||||||
|
wget -O translator.py https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Run get_and_save_refs.py
|
||||||
|
run: |
|
||||||
|
python scripts/get_and_save_refs.py
|
||||||
|
|
||||||
- name: Download language branch
|
- name: Download language branch
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory /__w/hacktricks/hacktricks
|
git config --global --add safe.directory /__w/hacktricks/hacktricks
|
||||||
@ -43,26 +58,30 @@ jobs:
|
|||||||
git checkout $BRANCH
|
git checkout $BRANCH
|
||||||
git pull
|
git pull
|
||||||
git checkout master
|
git checkout master
|
||||||
|
|
||||||
- name: Update & install translator.py (if needed)
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install wget -y
|
|
||||||
mkdir scripts
|
|
||||||
cd scripts
|
|
||||||
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
|
- name: Update the refs from master to language branch
|
||||||
|
run: |
|
||||||
|
python scripts/compare_and_fix_refs.py --files-unmatched-paths /tmp/file_paths.txt
|
||||||
|
|
||||||
- name: Run translation script on changed files
|
- name: Run translation script on changed files
|
||||||
run: |
|
run: |
|
||||||
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
|
||||||
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do
|
||||||
if echo "$file" | grep -qE '\.md$'; then
|
if echo "$file" | grep -qE '\.md$'; then
|
||||||
echo -n "$file , " >> /tmp/file_paths.txt
|
echo -n ",$file" >> /tmp/file_paths.txt
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3
|
|
||||||
|
if [ -s /tmp/file_paths.txt ]; then
|
||||||
|
python scripts/translator.py \
|
||||||
|
--language "$LANGUAGE" \
|
||||||
|
--branch "$BRANCH" \
|
||||||
|
--api-key "$OPENAI_API_KEY" \
|
||||||
|
-f "$(cat /tmp/file_paths.txt)" \
|
||||||
|
-t 3
|
||||||
|
else
|
||||||
|
echo "No markdown files changed, skipping translation."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build mdBook
|
- name: Build mdBook
|
||||||
run: |
|
run: |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user