Skip to content

docs: LLM translations #1

docs: LLM translations

docs: LLM translations #1

Workflow file for this run

name: Translate Docs
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches:
- main
paths:
- "docs/*"
permissions:
contents: write
pull-requests: write
jobs:
build:
name: Translate Docs
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- id: md_files
run: |
FILES=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- 'docs/*.md')
FILES=$(echo "$FILES" | xargs -n1 basename | tr '\n' ' ')
[ -z "$FILES" ] && echo "found=false" >> "$GITHUB_OUTPUT" || echo "found=true" >> "$GITHUB_OUTPUT"
echo "files=$FILES" >> "$GITHUB_OUTPUT"
- name: Set up PHP
if: steps.md_files.outputs.found == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: "8.5"
- name: run translation script
if: steps.md_files.outputs.found == 'true'
env:
GEMINI_API_KEY: "${{ secrets.GEMINI_API_KEY }}"
MD_FILES: "${{ steps.md_files.outputs.files }}"
run: |
php ./docs/translate.php "$MD_FILES"
- name: Run Linter
if: steps.md_files.outputs.found == 'true'
uses: super-linter/super-linter/slim@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdown-lint.yaml
FIX_NATURAL_LANGUAGE: true
FIX_MARKDOWN: true
- name: Create Pull Request
if: steps.md_files.outputs.found == 'true'
uses: peter-evans/create-pull-request@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "docs: update translations"
commit-message: "docs: update translations"
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
branch: translations/${{ github.run_id }}
delete-branch: true
body: |
Translation updates for: ${{ steps.md_files.outputs.files }}.
labels: |
translations
bot
draft: false