Skip to content

ci: add reusable docs-sync workflow for the dojoengine ecosystem#504

Merged
kronosapiens merged 1 commit intomainfrom
ci/reusable-docs-sync-workflow
Apr 23, 2026
Merged

ci: add reusable docs-sync workflow for the dojoengine ecosystem#504
kronosapiens merged 1 commit intomainfrom
ci/reusable-docs-sync-workflow

Conversation

@kronosapiens
Copy link
Copy Markdown
Collaborator

@kronosapiens kronosapiens commented Apr 23, 2026

Adds a single reusable workflow at .github/workflows/docs-sync.yml that consolidates the per-repo docs-sync workflows across the dojoengine ecosystem plus cartridge-gg/controller.

Why here

dojoengine/book is the natural home: it's the primary target docs repo, and it's public, which means cross-org callers (cartridge-gg/controllercartridge-gg/docs) can invoke it without any access-setting juggling.

How callers use it

Each source repo shrinks from ~200 lines of duplicated workflow to a ~30-line stub:

name: doc-sync
on:
  pull_request: { types: [closed], branches: [main] }
  workflow_dispatch:
    inputs:
      commit_sha: { required: true, type: string }

jobs:
  docs-sync:
    if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
    uses: dojoengine/book/.github/workflows/docs-sync.yml@main
    with:
      target-docs-repo: dojoengine/book
      source-repo-slug: dojoengine/katana
      diff-globs: |
        *.rs
        *.toml
      docs-patterns: |
        ^crates/.*\.rs$
        ^bin/.*\.rs$
      canonical-desc: "Katana is documented at docs/pages/toolchain/katana/ ..."
      docs-structure-desc: "The site uses Vocs. Content lives in docs/pages/ ..."
    secrets: inherit

Inputs

Input Purpose
target-docs-repo owner/name of the docs repo to open PRs against (e.g., dojoengine/book, cartridge-gg/docs)
source-repo-slug owner/name of the caller (e.g., dojoengine/katana). Short name is derived as ${slug##*/} — no separate name input needed.
diff-globs newline-separated pathspec globs passed to git diff --
docs-patterns newline-separated bash regexes; a changed file matching any triggers docs-sync
canonical-desc prose telling Claude which single page/section owns this caller's docs
docs-structure-desc prose describing the target docs repo's layout (Vocs content root, nav path, conventions)

Secrets are forwarded via secrets: inherit — each caller keeps its own CREATE_PR_TOKEN and ANTHROPIC_API_KEY, no new secrets land in this repo.

What the reusable workflow does

Same pipeline as the previously-per-repo versions:

  1. Checks out the source repo, computes diff between PR base and merge commit (or the manual commit_sha).
  2. Filters changed files against docs-patterns — if nothing matches, exits.
  3. Truncates the diff to 60KB and invokes anthropics/claude-code-action@beta with a tight ruleset (default to no changes, single canonical location, minimal edits, one code example per concept, never create new top-level sections).
  4. If Claude made edits, branches docs-update-<timestamp> on the target docs repo, commits, opens an auto-merging PR back-linking to the source PR.

Related PRs

Once this merges, these existing per-repo PRs will have the stubs take effect:

Sourced from cartridge-gg/controller/.github/workflows/docs-sync.yml with all per-repo variation extracted to workflow_call inputs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
book Ready Ready Preview Apr 23, 2026 3:45pm

Request Review

Consolidates per-repo docs-sync workflows across the dojoengine ecosystem
into a single reusable workflow hosted here. Callers (dojo, katana, torii,
torii-core, saya, dojo.js, dojo.c, dojo.unity, dojo.unreal, dojo.bevy, and
cartridge-gg/controller) invoke this via `uses:` and pass their repo-specific
diff globs, DOCS_PATTERNS, canonical docs path, and target docs repo.

Because this file lives in a public repo, cross-org callers (e.g.,
cartridge-gg/controller) can invoke it without special access configuration.
Callers forward their own CREATE_PR_TOKEN and ANTHROPIC_API_KEY via
`secrets: inherit`.
@kronosapiens kronosapiens force-pushed the ci/reusable-docs-sync-workflow branch from 492d25a to c5d52cf Compare April 23, 2026 15:41
@kronosapiens kronosapiens merged commit 8ef7297 into main Apr 23, 2026
2 checks passed
@kronosapiens kronosapiens deleted the ci/reusable-docs-sync-workflow branch April 23, 2026 15:46
tarrencev pushed a commit to cartridge-gg/controller that referenced this pull request Apr 24, 2026
Replaces the in-tree docs-sync workflow with a minimal stub that invokes
the shared reusable workflow hosted in `dojoengine/book`.

## Why

The docs-sync logic has been duplicated across 10+ source repos (dojo,
katana, torii, torii-core, saya, dojo.js, dojo.c, dojo.unity,
dojo.unreal, dojo.bevy, and this one). Any improvement to prompt rules,
diff handling, or PR creation had to be applied in 11 places. This
migration consolidates the pipeline into a single reusable workflow
(`dojoengine/book/.github/workflows/docs-sync.yml`) and leaves each
caller with a ~30-line stub.

## Cross-org reuse works

`dojoengine/book` is **public**, so `cartridge-gg/controller` can invoke
`uses: dojoengine/book/.github/workflows/docs-sync.yml@main` with no
access-setting changes. Controller keeps its own `CREATE_PR_TOKEN` and
`ANTHROPIC_API_KEY`; they're forwarded to the reusable workflow via
`secrets: inherit`.

## What changed

- `.github/workflows/docs-sync.yml` shrinks from ~180 lines to ~20.
- All pipeline logic (diff computation, `DOCS_PATTERNS` filter,
`claude-code-action` invocation, docs-PR branch/commit/auto-merge) moves
to the reusable workflow. Behavior is unchanged.
- Per-repo variation passed via `with:`:
  - `target-docs-repo: cartridge-gg/docs`
  - `source-repo-slug: cartridge-gg/controller`
- `diff-globs`, `docs-patterns`, `canonical-desc`, `docs-structure-desc`

## Merge order

**Requires `dojoengine/book#504` to land first** — that PR adds the
reusable workflow this stub references. Merging this before that means
the `uses:` ref won't resolve at trigger time.

## Related

Companion stubs across the dojoengine ecosystem:
- dojoengine/dojo#3405, katana#552, torii#427, torii-core#68, saya#71,
dojo.js#528, dojo.c#165, dojo.unity#117, dojo.unreal#2, dojo.bevy#6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant