GitHub Action Examples
Copy-paste workflows. All of them check without a key; only the last one translates.
1. Check every pull request (recommended)
# .github/workflows/i18n.yml
name: i18n check
on: [pull_request]
permissions:
contents: read
security-events: write
jobs:
i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Shipi18n/shipi18n-github-action@v3
with:
locales: ./locales
severity: 'missing-key=off,untranslated=off,orphan-key=off'
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: shipi18n.sarif2. Only when locale files change
on:
pull_request:
paths: ['public/locales/**'] # i18next: public/locales/<lang>/<ns>.json
# ...same job, with locales: public/locales3. Rails
- uses: Shipi18n/shipi18n-github-action@v3
with:
locales: config/locales
source-language: en
severity: 'missing-key=off,untranslated=off,orphan-key=off'Rails apps that already use i18n-tasks can add inconsistent_interpolations to their spec instead.
4. Adopt on an existing catalog with a baseline
# once, locally — commit the file:
npx @shipi18n/cli check ./locales -s en --baseline .shipi18n/baseline.json --write-baseline
# in the workflow:
- uses: Shipi18n/shipi18n-github-action@v3
with:
locales: ./locales
baseline: .shipi18n/baseline.json # only NEW findings fail the job5. Stricter: coverage and warnings
- uses: Shipi18n/shipi18n-github-action@v3
with:
locales: ./locales
fail-on: warning # warnings fail too
min-coverage: 95 # any language below 95% fails6. Check PRs, retranslate on main (your own key)
name: translate
on:
push:
branches: [main]
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@v3
with:
mode: translate
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
source-dir: locales/en
target-languages: es,fr,de
create-pr: 'true' # the check from example 1 runs on that PR