Skip to content

Add i18n-ai-translate GH action #3

Add i18n-ai-translate GH action

Add i18n-ai-translate GH action #3

name: i18n-ai-translate
on:
pull_request:
branches:
- master
paths:
- 'i18n/en.json'
jobs:
check-and-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Dependencies
run: yarn global add i18n-ai-translate
- name: Setup Git Config
run: |
git config --global user.email "[email protected]"
git config --global user.name "Taaha Mahdi"
- name: Fetch original translation
run: |
git checkout master -- i18n/en.json
cp i18n/en.json i18n/en-before.json
git checkout i18n/en.json
- name: Translate the diff
run: |
yarn run i18n-ai-translate diff -b i18n/en-before.json -a i18n/en.json -l "English" --api-key "${GEMINI_API_KEY}"
rm i18n/en-before.json
git add .
git commit -m "Update translations" || echo "No changes to commit"
git push