GitHub Action Examples
Copy-paste workflow configurations for common use cases.
Example 1: Basic Setup with PR
The most common setup - translates on push and creates a PR for review:
# .github/workflows/translate.yml
name: Translate
on:
push:
paths: ['locales/en/**']
workflow_dispatch: # Manual trigger from Actions tab
permissions:
contents: write
pull-requests: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'true'What happens:
- You push changes to
locales/en/ - Action detects changed files (~30 sec)
- Translations are created for es, fr, de
- A PR opens with all translations for review
Example 2: Direct Commit (No PR)
For solo developers who want instant translations without PRs:
name: Translate
on:
push:
paths: ['locales/en/**']
permissions:
contents: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'false' # Commits directlyExample 3: With LLM Verification (Pro)
Enable quality checks that catch translation errors automatically:
name: Translate with Verification
on:
push:
paths: ['locales/en/**']
permissions:
contents: write
pull-requests: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de,ja,zh
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'true'
verify: 'true' # Enable LLM verification
self-correct: 'true' # Auto-fix issuesVerification catches:
- • Missing placeholders (
{{name}}dropped in translation) - • Meaning drift (translation doesn't match source intent)
- • Format issues (broken HTML tags, markdown)
With self-correct: true, issues are automatically fixed before the PR is created.
Example 4: React + i18next
Standard React project structure:
name: Translate
on:
push:
paths: ['public/locales/en/**']
permissions:
contents: write
pull-requests: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: public/locales/en
output-dir: public/locales
target-languages: es,fr,de
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'true'Example 5: Next.js + next-intl
For Next.js projects with next-intl or similar:
name: Translate
on:
push:
paths: ['messages/en/**', 'messages/en.json']
permissions:
contents: write
pull-requests: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: messages/en
output-dir: messages
target-languages: es,fr,de,ja
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'true'Example 6: Many Languages (10+)
For apps supporting many locales:
name: Translate
on:
push:
paths: ['locales/en/**']
permissions:
contents: write
pull-requests: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de,it,pt,nl,ru,ja,ko,zh,ar
github-token: ${{ secrets.GITHUB_TOKEN }}
create-pr: 'true'Example 7: Manual Trigger Only
Only run when manually triggered (useful for large initial translations):
name: Translate (Manual)
on:
workflow_dispatch: # Only manual trigger
permissions:
contents: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de
github-token: ${{ secrets.GITHUB_TOKEN }}Typical PR Output
When translations complete, the PR description includes:
## Translation Update Translated 3 files to 5 languages. ### Files Updated - locales/es/common.json (25 keys) - locales/fr/common.json (25 keys) - locales/de/common.json (25 keys) - locales/ja/common.json (25 keys) - locales/zh/common.json (25 keys) ### Summary - Total keys: 125 - New translations: 125 - Cached (reused): 0 --- Generated by [Shipi18n](https://shipi18n.com)