This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Translator to HI (Hindi) | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'scripts/**' | |
- '.gitignore' | |
- '.github/**' | |
- Dockerfile | |
workflow_dispatch: | |
concurrency: hi | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
run-translation: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image:latest | |
environment: prod | |
env: | |
LANGUAGE: Hindi | |
BRANCH: hi | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Update & install translator.py (if needed) | |
run: | | |
cd scripts | |
rm -f translator.py | |
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py | |
cd .. | |
- name: Download language branch | |
run: | | |
git config --global user.name 'Translator' | |
git config --global user.email '[email protected]' | |
git checkout af | |
git pull | |
git checkout master | |
- name: Run translation script on changed files | |
run: | | |
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} | |
git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do | |
if echo "$file" | grep -qE '\.md$'; then | |
echo -n "$file , " >> /tmp/file_paths.txt | |
fi | |
done | |
python scripts/translator.py --language "Afrikaans" --branch "af" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 | |
- name: Commit and push changes | |
run: | | |
git checkout af | |
git add -A | |
git commit -m "Translated Afrikaans files" || true | |
git push --set-upstream origin af | |
- name: Build mdBook | |
run: | | |
MDBOOK_BOOK__LANGUAGE=af mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) | |
# Login in AWs | |
- name: Configure AWS credentials using OIDC | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: us-east-1 | |
# Sync the build to S3 | |
- name: Sync to S3 | |
run: aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete |