46 lines
2.1 KiB
Markdown
46 lines
2.1 KiB
Markdown
# i18n-sync
|
|
|
|
Fetches the latest translations from i18n.schmalz.com, commits them to a `chore/i18n` branch, and opens a pull request against the destination branch.
|
|
|
|
## Inputs
|
|
|
|
| Input | Required | Default | Description |
|
|
|-------|----------|---------|-------------|
|
|
| `i18n-application` | Yes | — | Application key in i18n.schmalz.com (e.g. `calculator`) |
|
|
| `locales-folder` | No | `locales` | Path to the locales directory relative to the repository root |
|
|
| `format-folder` | No | `""` | Directory containing the `package.json` whose format script should be run after downloading translations. Leave empty to skip formatting. |
|
|
| `format-script` | No | `format` | pnpm script name to run for formatting (e.g. `format`, `format:fix`) |
|
|
| `jfrog-token` | No | `""` | JFrog npm auth token (required when `format-folder` is set) |
|
|
| `forgejo-token` | Yes | — | Forgejo token with `contents:write` and `pull-requests:write` access |
|
|
| `destination-branch` | No | `dev` | Target branch for the pull request |
|
|
|
|
## Usage
|
|
|
|
Minimal — no formatting:
|
|
|
|
```yaml
|
|
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/i18n-sync@i18n-sync-v1
|
|
with:
|
|
i18n-application: my-app
|
|
forgejo-token: ${{ secrets.FORGEJO_I18N_UPDATE_TOKEN }}
|
|
```
|
|
|
|
With formatting after download:
|
|
|
|
```yaml
|
|
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/i18n-sync@i18n-sync-v1
|
|
with:
|
|
i18n-application: my-app
|
|
locales-folder: frontend/locales
|
|
format-folder: frontend
|
|
jfrog-token: ${{ secrets.JFROG_TOKEN }}
|
|
forgejo-token: ${{ secrets.FORGEJO_I18N_UPDATE_TOKEN }}
|
|
```
|
|
|
|
## Notes
|
|
|
|
- The action fails fast if the `chore/i18n` branch already exists, indicating a previous update is still pending review.
|
|
- If no translation changes are detected after downloading, the action exits cleanly without creating a branch or PR.
|
|
- Deleted languages (files removed from i18n.schmalz.com) are also staged for removal via `git add --all`.
|
|
- `jq` is installed automatically if not present on the runner.
|
|
- The `forgejo-token` must belong to a user or bot with `contents:write` and `pull-requests:write` permissions on the repository.
|