https://github.com/FidelusAleksander/ai-translate-action
GitHub Action for AI-powered file translation between different languages
https://github.com/FidelusAleksander/ai-translate-action
ai github-actions models translation
Last synced: 5 days ago
JSON representation
GitHub Action for AI-powered file translation between different languages
- Host: GitHub
- URL: https://github.com/FidelusAleksander/ai-translate-action
- Owner: FidelusAleksander
- License: mit
- Created: 2025-04-12T15:50:42.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-06-17T08:26:00.000Z (16 days ago)
- Last Synced: 2025-06-17T09:37:24.411Z (16 days ago)
- Topics: ai, github-actions, models, translation
- Language: TypeScript
- Homepage:
- Size: 1.01 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-continuous-ai - AI Translate Action - A GitHub Action that provides AI-powered text and file translation directly in your workflows. (Categories / Continuous Documentation)
- awesome-continuous-ai - AI Translate Action - A GitHub Action that provides AI-powered text and file translation directly in your workflows. (Categories / Continuous Documentation)
README
# AI Translate Action :globe_with_meridians:
[](https://github.com/FidelusAleksander/ai-translate-action/actions/workflows/test.yml)
[](https://opensource.org/licenses/MIT)
[](https://github.com/FidelusAleksander/ai-translate-action/releases)[](https://github.com/FidelusAleksander/ai-translate-action/blob/main/README.md) [](https://github.com/FidelusAleksander/ai-translate-action/blob/main/docs/README.pl.md) [](https://github.com/FidelusAleksander/ai-translate-action/blob/main/docs/README.es.md) [](https://github.com/FidelusAleksander/ai-translate-action/blob/main/docs/README.zh.md)
A GitHub Action that provides AI-powered text translation directly in your workflows.
- [AI Translate Action :globe\_with\_meridians:](#ai-translate-action-globe_with_meridians)
- [Basic Usage 🚀](#basic-usage-)
- [Translate text directly](#translate-text-directly)
- [Translate a text file](#translate-a-text-file)
- [Permissions 🔒](#permissions-)
- [Inputs ⚙️](#inputs-️)
- [Outputs 📤](#outputs-)
- [Cool examples 🎮](#cool-examples-)
- [Auto-translate README to multiple languages](#auto-translate-readme-to-multiple-languages)## Basic Usage 🚀
### Translate text directly
```yaml
- uses: FidelusAleksander/ai-translate-action@v1
with:
text: "Hello, world!"
target-language: "Spanish"
```### Translate a text file
```yaml
- uses: FidelusAleksander/ai-translate-action@v1
with:
text-file: README.md
target-language: "French"
```## Permissions 🔒
This action requires at minimum the following permissions set.
```yaml
permissions:
models: read
```## Inputs ⚙️
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `text` | The text to translate | No* | - |
| `text-file` | Path to a file containing the text to translate | No* | - |
| `target-language` | The language to translate the text into | Yes | - |
| `token` | Personal access token | No | `${{ github.token }}` |
| `model` | The AI model to use. See [available models](https://github.com/marketplace?type=models) | No | `gpt-4o` |
| `custom-instructions` | Optional additional instructions to customize translation behavior (e.g., "Don't translate code blocks" or "Keep technical terms in English") | No | - |\* Either `text` or `text-file` must be provided
## Outputs 📤
| Output | Description |
|--------|-------------|
| `translated-text` | The translated text |## Cool examples 🎮
Have you come up with a clever use of this action? Open a PR to showcase it here for the world to see!
### Auto-translate README to multiple languages
This action can be used to automatically translate your README into multiple languages whenever changes are made. Here's how this repository keeps its documentation in sync:
```yaml
name: Translate READMEon:
push:
branches:
- main
paths:
- "README.md"permissions:
contents: write
pull-requests: write
models: readjobs:
translate:
runs-on: ubuntu-latest
strategy:
matrix:
language: ["spanish", "chinese"]
include:
- language: "spanish"
file: "README.es.md"
- language: "chinese"
file: "README.zh.md"steps:
- uses: actions/checkout@v4- name: Translate README
uses: FidelusAleksander/ai-translate-action@v1
id: translate
with:
text-file: "README.md"
target-language: ${{ matrix.language }}
custom-instructions: "Keep technical terms in English. Don't translate code blocks"- name: Save translation
run: |
mkdir -p docs
echo "$TRANSLATED_TEXT" | tee docs/${{ matrix.file }}
env:
TRANSLATED_TEXT: ${{ steps.translate.outputs.translated-text }}- name: Upload translation artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.file }}
path: docs/${{ matrix.file }}create-pr:
needs: translate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: docs
merge-multiple: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "docs: update translations of README"
title: "docs: update translations of README"
body: |
This PR updates all translations of the README:Changes were automatically generated using the [ai-translate-action](https://github.com/FidelusAleksander/ai-translate-action) action.
branch: docs/update-readme-translations
add-paths: "docs/README*"
delete-branch: true
labels: |
documentation
```This workflow automatically translates the README into Spanish and Chinese whenever changes are made to the English version. It creates a pull request with the updated translations, making it easy to review the changes before merging.