Skip to content

docs: update a few pages to include more details (#881) #50

docs: update a few pages to include more details (#881)

docs: update a few pages to include more details (#881) #50

Workflow file for this run

name: "Update Translated Docs"
# To add more languages, you will update the following:
#
# 1. Update this file
# - Add '!docs/src/content/docs/{lang}/**' to `on.push.paths`
#
# 2. Update docs/astro.config.mjs
# - Add the new language to `plugins.starlightLlmsTxt.exclude` array
# - Update `translations` for `sidebar`'s items
# - Add the new language to `integrations.starlight.locales` array
#
# 3. Update docs/src/scripts/translate.ts
# - Various updates for the new language
#
on:
push:
branches:
- main
paths:
- 'docs/src/content/**'
- '!docs/src/content/docs/ja/**'
- '!docs/src/content/docs/zh/**'
- '!docs/src/content/docs/ko/**'
workflow_dispatch:
inputs:
translate_mode:
description: "Translation mode"
type: choice
options:
- only-changes
- full
default: only-changes
permissions:
contents: write
pull-requests: write
jobs:
update-docs:
if: "!contains(github.event.head_commit.message, 'Update all translated document pages')"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 10.28.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build workspace packages
run: pnpm build
- name: Translate docs
env:
OPENAI_API_KEY: ${{ secrets.PROD_OPENAI_API_KEY }}
run: |
mode="${{ inputs.translate_mode || 'only-changes' }}"
pnpm docs:translate -- --mode "$mode"
pnpm docs:build # to make sure if the generated docs are valid
- name: Commit changes
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/
if git diff --cached --quiet; then
echo "No changes to commit"
echo "committed=false" >> "$GITHUB_OUTPUT"
else
git commit -m "Update all translated document pages"
echo "committed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: steps.commit.outputs.committed == 'true'
uses: peter-evans/create-pull-request@v8
with:
commit-message: "Update all translated document pages"
title: "Update translated document pages"
body: |
Automated update of translated documentation.
Triggered by commit: [${{ github.event.head_commit.id }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.event.head_commit.id }}).
Message: `${{ github.event.head_commit.message }}`
branch: update-translated-docs-${{ github.run_id }}
delete-branch: true