Skip to content

Merge pull request #545 from helius-labs/feat/add-vercel-skills-cli-i… #309

Merge pull request #545 from helius-labs/feat/add-vercel-skills-cli-i…

Merge pull request #545 from helius-labs/feat/add-vercel-skills-cli-i… #309

Workflow file for this run

name: Auto-translate Documentation
on:
push:
branches: [main]
paths:
- '**.mdx'
- 'docs.json'
- 'i18n.json'
- 'openapi/**/*.yaml'
- '.github/workflows/i18n.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
translate:
runs-on: ubuntu-latest
# Skip if this is a translation merge commit
if: ${{ !contains(github.event.head_commit.message, 'Auto-update translations and sitemap') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Generate ParamField sections from OpenAPI specs
run: npm run generate:params
- name: Load environment variables
run: |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
- name: Run translation
run: npm run i18n
- name: Generate sitemap
run: npm run sitemap
- name: Check for changes
id: changes
run: |
git add -A
if git diff --cached --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Changes detected:"
git diff --cached --name-only
fi
- name: Close old translation PRs
if: steps.changes.outputs.changes == 'true'
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:auto-translations`
});
for (const pr of prs) {
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
state: 'closed'
});
console.log(`Closed old translation PR #${pr.number}`);
}
- name: Create Pull Request
if: steps.changes.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Auto-update translations and sitemap"
title: "Auto-update translations and sitemap"
body: |
This PR contains automatically generated translations and updated sitemap with hreflang tags.
**Changes:**
- Updated Chinese documentation files in `/zh/` directory
- Updated translation lock file (`i18n.lock`)
- Regenerated sitemap with hreflang tags for SEO (`sitemap.xml`)
**Triggered by:** ${{ github.event.head_commit.message }}
**Commit:** ${{ github.event.head_commit.id }}
**Timestamp:** ${{ github.event.head_commit.timestamp }}
---
This PR was automatically created by the i18n workflow and supersedes any previous translation PRs.
**Note:** `robots.txt` is a static file and doesn't need updates.
branch: auto-translations
delete-branch: true
reviewers: guneysol
add-paths: |
api-reference/
zh/
i18n.lock
sitemap.xml
docs.json