From 41c64727f4d5c14b69b5f12423c0fd0d71380d83 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Tue, 17 Feb 2026 11:34:53 -0700 Subject: [PATCH 1/2] ci: enable and improve docs-sync workflow Re-enable the docs-sync workflow by triggering on merged PRs to main and manual dispatch. Add diff content capture to provide Claude with actual code changes, not just file names. Specify the latest Claude model (sonnet-4-5) and rewrite the prompt with strict documentation rules (default to no changes, single canonical location, minimal edits, one example per concept). Include .cairo files in diff capture and docs pattern matching. Auto-merge generated documentation PRs after status checks pass. Co-Authored-By: Claude Haiku 4.5 --- .github/workflows/docs-sync.yml | 63 ++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/.github/workflows/docs-sync.yml b/.github/workflows/docs-sync.yml index 1e443e1c8f..1d0c4074d8 100644 --- a/.github/workflows/docs-sync.yml +++ b/.github/workflows/docs-sync.yml @@ -2,8 +2,8 @@ name: doc-sync on: pull_request: - #types: [closed] - branches: [disabled-at-the-moment] + types: [closed] + branches: [main] workflow_dispatch: inputs: commit_sha: @@ -31,17 +31,22 @@ jobs: run: | set -e if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - # Get changed files for the specified commit git fetch origin - CHANGED_FILES=$(git diff --name-only ${{ github.event.inputs.commit_sha }}~1 ${{ github.event.inputs.commit_sha }}) + DIFF_BASE="${{ github.event.inputs.commit_sha }}~1" + DIFF_HEAD="${{ github.event.inputs.commit_sha }}" else - # Get list of changed files in the merged PR git fetch origin main - CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.merge_commit_sha }}) + DIFF_BASE="${{ github.event.pull_request.base.sha }}" + DIFF_HEAD="${{ github.event.pull_request.merge_commit_sha }}" fi + CHANGED_FILES=$(git diff --name-only "$DIFF_BASE" "$DIFF_HEAD") + DIFF_CONTENT=$(git diff "$DIFF_BASE" "$DIFF_HEAD" -- '*.rs' '*.cairo' '*.toml' '*.md' | head -c 60000) echo "changed_files<> $GITHUB_OUTPUT echo "$CHANGED_FILES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + echo "diff_content<> $GITHUB_OUTPUT + echo "$DIFF_CONTENT" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - name: Check if docs update needed id: check-docs @@ -52,12 +57,12 @@ jobs: # Define patterns that typically require docs updates DOCS_PATTERNS=( "^crates/.*\.rs$" + "^crates/.*\.cairo$" "^crates/.*\.toml$" "^bin/.*\.rs$" "^bin/.*\.toml$" "^README\.md$" "^CHANGELOG\.md$" - "package\.json$" ) while IFS= read -r file; do @@ -85,8 +90,10 @@ jobs: uses: anthropics/claude-code-action@beta with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + model: "claude-sonnet-4-5-20250929" direct_prompt: | - I need you to analyze the changes in this dojo repository PR and update the documentation in the dojoengine/book repository accordingly. + Analyze changes in this dojo repository and update documentation + in the dojoengine/book repository ONLY if user-facing behavior changed. **Change Information:** - Title: ${{ github.event.pull_request.title || format('Manual trigger for commit {0}', github.event.inputs.commit_sha) }} @@ -94,23 +101,27 @@ jobs: - Files changed: ${{ steps.changed-files.outputs.changed_files }} - Commit SHA: ${{ github.event.pull_request.merge_commit_sha || github.event.inputs.commit_sha }} - **Your tasks:** - 1. Review the changed files and PR description to understand what functionality was added, modified, or removed - 2. Check the docs-repo directory to see what documentation currently exists - 3. Determine if any existing documentation needs updates or if new documentation should be created - 4. If updates are needed: - - Create or update the appropriate documentation files in the docs-repo directory - - Ensure the documentation accurately reflects the current state of the dojo - - Follow the existing documentation style and structure - - Focus on user-facing changes, API changes, new features, or breaking changes - - **Important guidelines:** - - Only create documentation updates if they are actually needed - - Don't document internal implementation details unless they affect usage - - If no documentation updates are needed, simply state that and exit - - DO NOT create git branches, commits, or PRs - just update the files - - The docs repository is checked out in the `docs-repo` directory. Please analyze the dojo changes and update the documentation files accordingly. + **Diff of changed files:** + ${{ steps.changed-files.outputs.diff_content }} + + **Docs repo structure** (checked out in `docs-repo/`): + The site uses Vocs. Content lives in `docs-repo/docs/pages/` with these sections: + - `getting-started/` — Your First Dojo App, Understanding the Toolchain, Development Workflow + - `framework/` — world/, models/, systems/, testing/, upgrading/, configuration/ + - `toolchain/` — sozo/, katana/, torii/, saya/, cainome + - `client/sdk/` — dojo.js, dojo.c, dojo.unity, dojo.unreal, dojo.godot, dojo.bevy, dojo.rust, dojo.telegram + - `tutorials/` — Dojo 101, Deploy to Mainnet, Deploy using Slot + - `libraries/` — Origami, Alexandria + - `scaling/` — Execution Sharding, Sovereign Rollups + Sidebar config is in `docs-repo/routes.ts`, imported by `docs-repo/vocs.config.ts`. + + **Rules — read these carefully:** + 1. DEFAULT TO NO CHANGES. Most code PRs do not need docs updates. Internal refactors, test changes, CI changes, and dependency bumps need nothing. Only proceed if there is a concrete user-facing change (new API, changed behavior, new feature, removed feature, changed configuration). + 2. SINGLE CANONICAL LOCATION. Each piece of information belongs on exactly one page. Find the one page that owns the topic and make your substantive edits there. Other pages MAY add a brief cross-reference linking to the canonical page, but do NOT duplicate explanations, code samples, or configuration details across multiple pages. + 3. MINIMAL EDITS. Update only the specific section affected. Do not rewrite surrounding paragraphs, add new sections for context, or reorganize existing content. + 4. ONE CODE EXAMPLE per concept. If a code sample is needed, add it once in the canonical location. Do not add the same or similar examples to multiple pages. + 5. Do NOT create git branches, commits, or PRs — just update files. + 6. If no documentation updates are needed, state that clearly and exit. allowed_tools: "Read,Write,Edit,MultiEdit,Glob,Grep" @@ -161,6 +172,7 @@ jobs: - Trigger: Manual documentation sync Please review the documentation changes to ensure they accurately reflect the dojo updates." + gh pr merge --auto --squash else gh pr create \ --title "docs: Update documentation for dojo PR #${{ github.event.pull_request.number }}" \ @@ -171,6 +183,7 @@ jobs: - Files changed: ${{ steps.changed-files.outputs.changed_files }} Please review the documentation changes to ensure they accurately reflect the dojo updates." + gh pr merge --auto --squash fi else echo "No documentation changes were made by Claude" From a73da961c65cb35b2f14b2c13f6ef59b0aeef9bb Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Tue, 17 Feb 2026 11:49:39 -0700 Subject: [PATCH 2/2] ci: pass explicit PR URL to gh pr merge Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docs-sync.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-sync.yml b/.github/workflows/docs-sync.yml index 1d0c4074d8..10af96dbb4 100644 --- a/.github/workflows/docs-sync.yml +++ b/.github/workflows/docs-sync.yml @@ -162,7 +162,7 @@ jobs: # Create PR if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - gh pr create \ + PR_URL=$(gh pr create \ --title "docs: Update documentation for dojo commit ${{ github.event.inputs.commit_sha }}" \ --body "This PR updates the documentation to reflect changes made in dojoengine/dojo commit ${{ github.event.inputs.commit_sha }} @@ -171,10 +171,10 @@ jobs: - Files changed: ${{ steps.changed-files.outputs.changed_files }} - Trigger: Manual documentation sync - Please review the documentation changes to ensure they accurately reflect the dojo updates." - gh pr merge --auto --squash + Please review the documentation changes to ensure they accurately reflect the dojo updates.") + gh pr merge "$PR_URL" --auto --squash else - gh pr create \ + PR_URL=$(gh pr create \ --title "docs: Update documentation for dojo PR #${{ github.event.pull_request.number }}" \ --body "This PR updates the documentation to reflect changes made in dojoengine/dojo#${{ github.event.pull_request.number }} @@ -182,8 +182,8 @@ jobs: - Title: ${{ github.event.pull_request.title }} - Files changed: ${{ steps.changed-files.outputs.changed_files }} - Please review the documentation changes to ensure they accurately reflect the dojo updates." - gh pr merge --auto --squash + Please review the documentation changes to ensure they accurately reflect the dojo updates.") + gh pr merge "$PR_URL" --auto --squash fi else echo "No documentation changes were made by Claude"