Skip to content

ci: add docs-sync workflow to open PRs against dojoengine/book#3405

Closed
kronosapiens wants to merge 1 commit intomainfrom
ci/docs-sync-workflow
Closed

ci: add docs-sync workflow to open PRs against dojoengine/book#3405
kronosapiens wants to merge 1 commit intomainfrom
ci/docs-sync-workflow

Conversation

@kronosapiens
Copy link
Copy Markdown
Contributor

@kronosapiens kronosapiens commented Apr 23, 2026

Adds a caller stub that invokes the shared reusable docs-sync workflow hosted in dojoengine/book.

What it does

On each merged PR to main (plus manual workflow_dispatch), the stub calls dojoengine/book/.github/workflows/docs-sync.yml@main with this repo's parameters (diff globs, DOCS_PATTERNS, canonical docs page). The shared workflow diffs the PR, runs anthropics/claude-code-action@beta with a tight "default to no changes / single canonical location / minimal edits" ruleset, and — if Claude made edits — opens an auto-merging PR to dojoengine/book with the suggested changes.

Per-repo parameters

See the with: block in the diff. Canonical docs location for this repo:

dojo: docs/pages/framework/ and docs/pages/toolchain/sozo/ in dojoengine/book.

Requires these secrets (forwarded via secrets: inherit)

  • CREATE_PR_TOKEN — PAT with contents: write on dojoengine/book.
  • ANTHROPIC_API_KEY — for anthropics/claude-code-action@beta.

Merge order

Merge dojoengine/book#504 first — that's what adds the reusable workflow this stub references. Merging this stub before that one means the workflow will fail at invocation time (the uses: ref won't resolve).

Related

Companion stub PRs across the dojoengine ecosystem, all pointing at the same reusable workflow:

Cross-org companion stub:

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Ohayo, sensei! 👋

Walkthrough

The .github/workflows/docs-sync.yml workflow was replaced with a call to the reusable dojoengine/book docs-sync.yml, passing diff globs, doc-path patterns, and descriptions; the previous inline implementation (commit/diff logic, heuristics, Claude calls, checkout, PR creation) was removed. Display name set to docs-sync.

Changes

Cohort / File(s) Summary
Workflow Refactor
.github/workflows/docs-sync.yml
Removed ~182 lines of inline docs-sync logic and replaced with a reusable workflow invocation to dojoengine/book/docs-sync.yml. Now supplies diff globs (*.rs, *.cairo, *.toml, *.md), doc path patterns, structure descriptions, and inherits secrets; display name changed to docs-sync.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ci: add docs-sync workflow to open PRs against dojoengine/book' directly reflects the main change: adding a workflow stub that invokes a reusable docs-sync workflow to open PRs against dojoengine/book.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/docs-sync-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/docs-sync.yml:
- Line 17: The reusable workflow reference "uses:
dojoengine/book/.github/workflows/docs-sync.yml@main" points at a workflow that
doesn't exist yet and will cause dispatch to fail; either keep this PR blocked
until the companion workflow in dojoengine/book is merged to main, or change the
ref in that uses string to a stable existing ref (e.g., a commit SHA or
tag/branch that already contains the docs-sync workflow) so the action resolves
successfully; update the uses line accordingly and ensure the chosen ref indeed
contains .github/workflows/docs-sync.yml before pushing.
- Line 35: Update the reusable workflow reference and remove broad secret
inheritance: replace the invalid call to
"dojoengine/book/.github/workflows/docs-sync.yml@main" with the correct existing
workflow file in that repo (e.g.,
"dojoengine/book/.github/workflows/defrag-docs.yaml@main" or the appropriate
filename you confirm) and then change the reusable workflow invocation to stop
using "secrets: inherit" — explicitly map only the required secrets (e.g.,
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}, DOJO_API_KEY: ${{
secrets.DOJO_API_KEY }}, etc.) in the workflow call so the job only receives
least-privilege secrets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff140295-8bb1-4879-ab1d-f992897d5600

📥 Commits

Reviewing files that changed from the base of the PR and between 9b64ea8 and 77fddb2.

📒 Files selected for processing (1)
  • .github/workflows/docs-sync.yml

Comment thread .github/workflows/docs-sync.yml
Comment thread .github/workflows/docs-sync.yml
@kronosapiens kronosapiens changed the title ci: enable docs-sync workflow and port to controller template ci: enable docs-sync workflow to open PRs against dojoengine/book Apr 23, 2026
@kronosapiens kronosapiens changed the title ci: enable docs-sync workflow to open PRs against dojoengine/book ci: add docs-sync workflow to open PRs against dojoengine/book Apr 23, 2026
Replaces the disabled docs-sync workflow (trigger was
branches: [disabled-at-the-moment]) with the current cartridge-gg/controller
template. On each merged PR to main (and on manual workflow_dispatch),
Claude analyzes the diff and, if user-facing behavior changed, opens an
auto-merging PR to dojoengine/book with targeted docs updates.

Requires repository secrets: CREATE_PR_TOKEN, ANTHROPIC_API_KEY.
@kronosapiens kronosapiens force-pushed the ci/docs-sync-workflow branch from 77fddb2 to b79a07a Compare April 23, 2026 17:33
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/docs-sync.yml:
- Around line 29-32: The YAML block under canonical-desc contains extra leading
spaces on the two bullet lines causing a preserved hanging indent; edit the
canonical-desc block so the two list lines start at the same column as the first
description line (remove the ~20 extra spaces before "-
docs-repo/docs/pages/framework/..." and "-
docs-repo/docs/pages/toolchain/sozo/..."), ensuring the block scalar preserves
the intended alignment when consumed by the downstream prompt processor; verify
the resulting indentation matches the line with "The Dojo framework..." so
rendering is consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a11f331c-18ed-4255-9c41-101d82bf44af

📥 Commits

Reviewing files that changed from the base of the PR and between 77fddb2 and b79a07a.

📒 Files selected for processing (1)
  • .github/workflows/docs-sync.yml

Comment on lines +29 to +32
canonical-desc: |
The Dojo framework and sozo CLI are documented in two sections of dojoengine/book:
- docs-repo/docs/pages/framework/ — World, models, systems, events, testing, authorization, config
- docs-repo/docs/pages/toolchain/sozo/ — sozo CLI commands and workflows
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Ohayo sensei — stray indentation inside canonical-desc.

Lines 31–32 carry ~20 extra leading spaces before the - bullets, which the YAML block scalar preserves verbatim when forwarded to Claude. Not a bug, but the prompt string will render with a weird hanging indent compared to the other *-desc inputs. Trim to match the indent of line 30.

✂️ Proposed tidy-up
       canonical-desc: |
         The Dojo framework and sozo CLI are documented in two sections of dojoengine/book:
-                    - docs-repo/docs/pages/framework/ — World, models, systems, events, testing, authorization, config
-                    - docs-repo/docs/pages/toolchain/sozo/ — sozo CLI commands and workflows
+        - docs-repo/docs/pages/framework/ — World, models, systems, events, testing, authorization, config
+        - docs-repo/docs/pages/toolchain/sozo/ — sozo CLI commands and workflows
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
canonical-desc: |
The Dojo framework and sozo CLI are documented in two sections of dojoengine/book:
- docs-repo/docs/pages/framework/ — World, models, systems, events, testing, authorization, config
- docs-repo/docs/pages/toolchain/sozo/ — sozo CLI commands and workflows
canonical-desc: |
The Dojo framework and sozo CLI are documented in two sections of dojoengine/book:
- docs-repo/docs/pages/framework/ — World, models, systems, events, testing, authorization, config
- docs-repo/docs/pages/toolchain/sozo/ — sozo CLI commands and workflows
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/docs-sync.yml around lines 29 - 32, The YAML block under
canonical-desc contains extra leading spaces on the two bullet lines causing a
preserved hanging indent; edit the canonical-desc block so the two list lines
start at the same column as the first description line (remove the ~20 extra
spaces before "- docs-repo/docs/pages/framework/..." and "-
docs-repo/docs/pages/toolchain/sozo/..."), ensuring the block scalar preserves
the intended alignment when consumed by the downstream prompt processor; verify
the resulting indentation matches the line with "The Dojo framework..." so
rendering is consistent.

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.
@kronosapiens
Copy link
Copy Markdown
Contributor Author

Closed in favor of https://github.com/cartridge-gg/internal/pull/4422

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