repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

.github/workflows/adw-docs.yml

Raw
File outline
# ADW docs — when a merged PR touches product code, the docs-writer keeps the user
# docs, SDK annotations, and site true to it. Runs on Codex (gpt-5.6-terra, medium
# effort — text generation), authenticated as the App; charter injected from
# .claude/agents/docs-writer.md. paths-ignore skips doc-only/site-only/prototype/
# config merges — which also breaks the loop: a docs-only PR merges without
# re-triggering this workflow.
name: adw-docs

on:
  pull_request:
    types: [closed]
    paths-ignore:
      - "docs/**"
      - "site/**"
      - "prototypes/**"
      - ".github/**"

permissions:
  contents: write
  pull-requests: write

concurrency:
  group: adw-docs-${{ github.event.pull_request.number }}
  cancel-in-progress: false

jobs:
  docs:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - id: token
        uses: actions/create-github-app-token@v1
        with:
          app-id: ${{ secrets.APP_ID }}
          private-key: ${{ secrets.APP_PRIVATE_KEY }}
      - uses: actions/checkout@v4
        with:
          # Persist the App token (not the ambient GITHUB_TOKEN) so the full-access
          # Codex step has only one credential in reach, and git push works.
          token: ${{ steps.token.outputs.token }}
      - name: Codex auth + config
        env:
          CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}
        run: |
          mkdir -p ~/.codex
          printf '%s' "$CODEX_AUTH_JSON" > ~/.codex/auth.json
          chmod 600 ~/.codex/auth.json
          printf 'project_doc_fallback_filenames = ["CLAUDE.md"]\n' > ~/.codex/config.toml
      - run: npm install -g @openai/codex@0.145.0
      - name: docs-writer updates the docs
        env:
          GH_TOKEN: ${{ steps.token.outputs.token }}
          REPO: ${{ github.repository }}
          PR: ${{ github.event.pull_request.number }}
        run: |
          git config user.name "agent-smith-bugabinga-adc[bot]"
          git config user.email "agent-smith-bugabinga-adc[bot]@users.noreply.github.com"
          codex exec -m gpt-5.6-terra -c model_reasoning_effort="medium" --sandbox danger-full-access "$(awk 'f>=2{print} /^---$/{f++}' .claude/agents/docs-writer.md)

          You are docs-writer running headless in CI for ${REPO} (the gh CLI is configured via GH_TOKEN). Follow the charter above. Merged PR #${PR} changed product code. Read its diff (gh pr diff ${PR}); if it changed user-facing behavior or the Lua SDK, update the docs to match — SDK ---@ annotations, guides, smith help topics, and the site/book sources. If nothing user-facing changed, do nothing and stop. When you do change docs: make them on a new branch (docs/pr-${PR}), commit, push, and open a PR with gh pr create against main. Never invent undocumented behavior; never edit docs/SPEC.md; never merge."