Skip to content

docs: clarify Codex run-context threading guidance and examples (#942) #54

docs: clarify Codex run-context threading guidance and examples (#942)

docs: clarify Codex run-context threading guidance and examples (#942) #54

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: "github.repository == 'openai/openai-agents-js' && (github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, 'docs: update translated document pages'))"
runs-on: ubuntu-latest
steps:
- name: Ensure main workflow
if: ${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }}
run: |
echo "This workflow must be dispatched from main."
exit 1
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
with:
version: 10.28.2
run_install: false
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
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 "docs: update 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@c0f553fe549906ede9cf27b5156039d195d2ece0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: update translated document pages"
title: "docs: 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