chore: add docs-sync workflow to open PRs against dojoengine/book#528
chore: add docs-sync workflow to open PRs against dojoengine/book#528kronosapiens wants to merge 1 commit intodojoengine:mainfrom
Conversation
📝 WalkthroughWalkthroughA new GitHub Actions workflow is introduced that automatically synchronizes documentation. Triggered on PR closure or manual dispatch, it computes git diffs, determines if source changes require documentation updates, invokes Claude API to modify SDK documentation, and creates a self-merging PR with changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (4)
.github/workflows/docs-sync.yml (4)
1-1: Workflow name doesn't match filename.
name: doc-sync(singular) while filename and PR title usedocs-sync. Consider aligning for consistency with the source workflow incartridge-gg/controllerand the PR description.♻️ Proposed fix
-name: doc-sync +name: docs-sync🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/docs-sync.yml at line 1, Update the workflow's top-level name field from "doc-sync" to "docs-sync" so the workflow display name matches the filename and PR title; locate the YAML key `name:` in the workflow definition and change its value to "docs-sync" for consistency with the repository's naming conventions and the referenced controller workflow.
160-183:gh pr merge --auto --squashwithout a PR reference.Without a
<pr-number>|<url>|<branch>argument,gh pr mergeresolves the PR from the current branch in the working directory. That does work here (cwd isdocs-repo, HEAD is the pushed$BRANCH_NAME), but it's implicit and will silently target the wrong PR if a future edit introduces acdor checkout betweengh pr createandgh pr merge. Capture the URL fromgh pr createand pass it explicitly:- gh pr create \ + PR_URL=$(gh pr create \ --title "…" \ - --body "…" - gh pr merge --auto --squash + --body "…") + gh pr merge --auto --squash "$PR_URL"Also note that
--autorequires auto-merge to be enabled on thedojoengine/bookrepository and the token to havecontents: write+ the ability to enable auto-merge — worth confirming as part of the rollout checklist mentioned in the PR description.🤖 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 160 - 183, The gh pr merge call is invoked without an explicit PR identifier which is fragile; capture the PR URL returned by gh pr create and pass it to gh pr merge. Update both branches of the if/else to run gh pr create with --json url -q (or otherwise capture stdout) into a variable like PR_URL (or CREATED_PR_URL) immediately after gh pr create, then call gh pr merge "$PR_URL" --auto --squash instead of calling gh pr merge with no args; keep the gh pr create and gh pr merge calls grouped so no intervening cd/checkout can change the working branch.
44-52:CHANGED_FILESis unfiltered; trim it to matchDOCS_PATTERNS.
git diff --name-only "$DIFF_BASE" "$DIFF_HEAD"emits every changed path (lockfiles, generated files,.github/**, docs, assets). It then gets shipped into:
- the
DOCS_PATTERNSloop, which is cheap but noisy, and- the Claude
direct_promptand the PR/commit body, where it inflates the prompt and can leak irrelevant paths.Consider pre-filtering to the same globs used for
DIFF_CONTENT('*.ts' '*.tsx' '*.md') or at least topackages/**, so the list stays meaningful and bounded.🤖 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 44 - 52, CHANGED_FILES currently contains every changed path; limit it to the same doc/source globs used for DIFF_CONTENT to avoid leaking irrelevant files: when generating CHANGED_FILES (the variable set from git diff --name-only "$DIFF_BASE" "$DIFF_HEAD"), filter the output to the DOCS_PATTERNS used later (e.g., the same globs `'*.ts' '*.tsx' '*.md'` or packages/**) so CHANGED_FILES only includes matching paths before writing it to GITHUB_OUTPUT; update the assignment that creates CHANGED_FILES to perform this filtering so DIFF_CONTENT and CHANGED_FILES are consistent.
46-46:head -c 60000can truncate mid-line and mid-UTF-8 character.Cutting by bytes in the middle of a diff can leave a dangling hunk header and break multibyte characters in source comments/strings, which can confuse the model.
head -n(e.g.,head -n 1500) or aawk-based limiter keeps the diff structurally valid.- DIFF_CONTENT=$(git diff "$DIFF_BASE" "$DIFF_HEAD" -- '*.ts' '*.tsx' '*.md' | head -c 60000) + DIFF_CONTENT=$(git diff "$DIFF_BASE" "$DIFF_HEAD" -- '*.ts' '*.tsx' '*.md' | head -n 1500)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/docs-sync.yml at line 46, The DIFF_CONTENT assignment uses byte-truncation ("head -c 60000") which can cut mid-line or mid-UTF-8 character and break diff hunk headers; update the DIFF_CONTENT creation (the git diff pipeline that references DIFF_BASE and DIFF_HEAD and currently pipes to "head -c 60000") to limit by lines or records instead (for example replace the byte-based limiter with a line-based limiter like head -n or an awk/sed-based row limiter) so the diff stays structurally valid and multibyte characters aren’t split.
🤖 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 35-43: Fix the workflow_dispatch path to reliably fetch and diff
arbitrary SHAs: fetch the exact input commit instead of relying on default refs
(replace git fetch origin with fetching the specific
github.event.inputs.commit_sha), set DIFF_HEAD to the provided commit SHA, and
compute DIFF_BASE by resolving the commit's parent defensively (use git
rev-parse "${COMMIT_SHA}^" with a fallback to the empty-tree sentinel when
rev-parse fails so root commits yield a meaningful diff); avoid using the naive
"~1" suffix which breaks for root and merge commits. Ensure you update the
DIFF_BASE/DIFF_HEAD assignments (and any usages of commit_sha, DIFF_BASE,
DIFF_HEAD) accordingly.
- Around line 143-183: The commit/PR message strings passed to git commit -m and
gh pr create are preserving YAML indentation causing leading spaces in messages;
replace those multi-line double-quoted bash arguments with a dedented heredoc
(e.g., build the message via a cat <<EOF / printf fed from env vars) or
construct the body using printf and environment variables
(github.event.inputs.commit_sha, github.event.pull_request.number,
github.event.pull_request.title, steps.changed-files.outputs.changed_files,
BRANCH_NAME) so the messages passed to git commit and gh pr create are not
indented by the YAML block; also consider moving repeated values into env: and
reference them when building the heredoc/printf to keep the workflow readable.
- Around line 44-73: The workflow currently interpolates untrusted GitHub
expression outputs directly into shell scripts (e.g.,
steps.changed-files.outputs.changed_files,
steps.changed-files.outputs.diff_content, github.event.pull_request.title/body,
inputs.commit_sha) which allows script injection; fix by reading each untrusted
value into safe environment variables at the top of each run block (e.g.,
PR_TITLE, PR_BODY, CHANGED_FILES, DIFF_CONTENT, COMMIT_SHA) using the GitHub
expression only in the step's env mapping, then reference those env vars
(double-quoted) inside the script (use while IFS= read -r file; do ... done <<<
"$CHANGED_FILES" and printf '%s' "$CHANGED_FILES" when echoing), and for LLM
prompts write DIFF_CONTENT to a temporary file or wrap it in a clearly delimited
block rather than embedding raw content into YAML strings; apply this pattern to
the check-docs step, the commit/branch creation steps (git commit -m and gh pr
create usages), and any other run blocks that use those outputs.
- Around line 85-88: The workflow is using the beta action tag and deprecated
input names; update the action reference from
"anthropics/claude-code-action@beta" to "anthropics/claude-code-action@v1",
replace any deprecated input "direct_prompt" with the new "prompt" input, keep
"anthropic_api_key" as-is, and if you need to pin the model move the model flag
into "claude_args" (e.g. "--model claude-sonnet-4-5-20250929") or use the new
model input per v1 schema instead of the current "model" field.
---
Nitpick comments:
In @.github/workflows/docs-sync.yml:
- Line 1: Update the workflow's top-level name field from "doc-sync" to
"docs-sync" so the workflow display name matches the filename and PR title;
locate the YAML key `name:` in the workflow definition and change its value to
"docs-sync" for consistency with the repository's naming conventions and the
referenced controller workflow.
- Around line 160-183: The gh pr merge call is invoked without an explicit PR
identifier which is fragile; capture the PR URL returned by gh pr create and
pass it to gh pr merge. Update both branches of the if/else to run gh pr create
with --json url -q (or otherwise capture stdout) into a variable like PR_URL (or
CREATED_PR_URL) immediately after gh pr create, then call gh pr merge "$PR_URL"
--auto --squash instead of calling gh pr merge with no args; keep the gh pr
create and gh pr merge calls grouped so no intervening cd/checkout can change
the working branch.
- Around line 44-52: CHANGED_FILES currently contains every changed path; limit
it to the same doc/source globs used for DIFF_CONTENT to avoid leaking
irrelevant files: when generating CHANGED_FILES (the variable set from git diff
--name-only "$DIFF_BASE" "$DIFF_HEAD"), filter the output to the DOCS_PATTERNS
used later (e.g., the same globs `'*.ts' '*.tsx' '*.md'` or packages/**) so
CHANGED_FILES only includes matching paths before writing it to GITHUB_OUTPUT;
update the assignment that creates CHANGED_FILES to perform this filtering so
DIFF_CONTENT and CHANGED_FILES are consistent.
- Line 46: The DIFF_CONTENT assignment uses byte-truncation ("head -c 60000")
which can cut mid-line or mid-UTF-8 character and break diff hunk headers;
update the DIFF_CONTENT creation (the git diff pipeline that references
DIFF_BASE and DIFF_HEAD and currently pipes to "head -c 60000") to limit by
lines or records instead (for example replace the byte-based limiter with a
line-based limiter like head -n or an awk/sed-based row limiter) so the diff
stays structurally valid and multibyte characters aren’t split.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: b8b9ed4f-d9ee-4b3a-bf83-131f5fcb5daa
📒 Files selected for processing (1)
.github/workflows/docs-sync.yml
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| git fetch origin | ||
| DIFF_BASE="${{ github.event.inputs.commit_sha }}~1" | ||
| DIFF_HEAD="${{ github.event.inputs.commit_sha }}" | ||
| else | ||
| git fetch origin main | ||
| DIFF_BASE="${{ github.event.pull_request.base.sha }}" | ||
| DIFF_HEAD="${{ github.event.pull_request.merge_commit_sha }}" | ||
| fi |
There was a problem hiding this comment.
workflow_dispatch path breaks on root commits and merge commits.
DIFF_BASE="${{ github.event.inputs.commit_sha }}~1"fails if the provided SHA has zero parents (root commit) or multiple parents (merge commit, where~1picks the first-parent and silently returns a different diff than users likely expect).git fetch originwithout a refspec uses the remote's default and may not fetch the specific SHA if it's unreachable from any branch tip; for arbitrary commit SHAs, prefergit fetch origin "$COMMIT_SHA"(requiresuploadpack.allowReachableSHA1InWant/allowAnySHA1InWant, generally enabled on github.com).- Consider resolving the parent defensively with
git rev-parse "${COMMIT_SHA}^" 2>/dev/null || git hash-object -t tree /dev/null(empty-tree sentinel) so root commits still produce a meaningful diff.
🤖 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 35 - 43, Fix the
workflow_dispatch path to reliably fetch and diff arbitrary SHAs: fetch the
exact input commit instead of relying on default refs (replace git fetch origin
with fetching the specific github.event.inputs.commit_sha), set DIFF_HEAD to the
provided commit SHA, and compute DIFF_BASE by resolving the commit's parent
defensively (use git rev-parse "${COMMIT_SHA}^" with a fallback to the
empty-tree sentinel when rev-parse fails so root commits yield a meaningful
diff); avoid using the naive "~1" suffix which breaks for root and merge
commits. Ensure you update the DIFF_BASE/DIFF_HEAD assignments (and any usages
of commit_sha, DIFF_BASE, DIFF_HEAD) accordingly.
| CHANGED_FILES=$(git diff --name-only "$DIFF_BASE" "$DIFF_HEAD") | ||
| # Truncate diff to avoid blowing up the prompt | ||
| DIFF_CONTENT=$(git diff "$DIFF_BASE" "$DIFF_HEAD" -- '*.ts' '*.tsx' '*.md' | head -c 60000) | ||
| echo "changed_files<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$CHANGED_FILES" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| echo "diff_content<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$DIFF_CONTENT" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Check if docs update needed | ||
| id: check-docs | ||
| run: | | ||
| NEEDS_DOCS_UPDATE=false | ||
|
|
||
| DOCS_PATTERNS=( | ||
| "^packages/.*/src/.*\.(ts|tsx)$" | ||
| ) | ||
|
|
||
| while IFS= read -r file; do | ||
| for pattern in "${DOCS_PATTERNS[@]}"; do | ||
| if [[ $file =~ $pattern ]]; then | ||
| NEEDS_DOCS_UPDATE=true | ||
| break 2 | ||
| fi | ||
| done | ||
| done <<< "${{ steps.changed-files.outputs.changed_files }}" | ||
|
|
||
| echo "needs_update=$NEEDS_DOCS_UPDATE" >> $GITHUB_OUTPUT | ||
| echo "Files that may need docs updates: $(echo '${{ steps.changed-files.outputs.changed_files }}' | tr '\n' ' ')" |
There was a problem hiding this comment.
Script injection risk: route untrusted PR/commit data through env vars.
Multiple shell steps interpolate GitHub expressions that originate from attacker-controllable inputs directly into bash -e scripts, allowing arbitrary command execution in the runner (which holds CREATE_PR_TOKEN and ANTHROPIC_API_KEY):
- Line 70:
<<< "${{ steps.changed-files.outputs.changed_files }}"— a crafted filename (foo";curl …#) in a PR diff becomes part of the shell here-string. - Line 73:
echo '${{ steps.changed-files.outputs.changed_files }}'— single-quote injection is trivial with filenames containing'. - Lines 143, 150, 153, 155, 162-170, 173-181:
${{ github.event.pull_request.title }},.body,.inputs.commit_sha, andchanged_filesinterpolated intogit commit -m "…"andgh pr create --title/--body "…"double-quoted strings. A PR title with"; rm -rf … #or backticks escapes the quoted context. - Line 100:
${{ steps.changed-files.outputs.diff_content }}goes into thedirect_promptYAML string — injection here is into the LLM prompt rather than the shell, but untrusted content is still fed as instructions; consider isolating it (e.g., wrapping the diff in a clearly delimited block in the prompt, and omitting the body entirely if not needed).
This is the issue actionlint flagged on line 133 and applies more broadly. The standard fix is to read these values from environment variables in each run: block so the runner's expression substitution never touches the shell command line.
🛡️ Proposed fix (apply the same pattern to every affected step)
- name: Check if docs update needed
id: check-docs
+ env:
+ CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }}
run: |
NEEDS_DOCS_UPDATE=false
DOCS_PATTERNS=(
"^packages/.*/src/.*\.(ts|tsx)$"
)
while IFS= read -r file; do
for pattern in "${DOCS_PATTERNS[@]}"; do
if [[ $file =~ $pattern ]]; then
NEEDS_DOCS_UPDATE=true
break 2
fi
done
- done <<< "${{ steps.changed-files.outputs.changed_files }}"
+ done <<< "$CHANGED_FILES"
echo "needs_update=$NEEDS_DOCS_UPDATE" >> $GITHUB_OUTPUT
- echo "Files that may need docs updates: $(echo '${{ steps.changed-files.outputs.changed_files }}' | tr '\n' ' ')"
+ printf 'Files that may need docs updates: %s\n' "$(printf '%s' "$CHANGED_FILES" | tr '\n' ' ')"Apply the equivalent pattern to the “Create branch and commit changes” step:
env:
GITHUB_TOKEN: ${{ secrets.CREATE_PR_TOKEN }}
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ PR_BODY: ${{ github.event.pull_request.body }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ COMMIT_SHA: ${{ github.event.inputs.commit_sha }}
+ CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }}
+ EVENT_NAME: ${{ github.event_name }}Then reference "$PR_TITLE", "$PR_BODY", etc., inside the script — double-quoted — so the values never participate in shell tokenization.
See GitHub's script-injection guidance.
🤖 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 44 - 73, The workflow currently
interpolates untrusted GitHub expression outputs directly into shell scripts
(e.g., steps.changed-files.outputs.changed_files,
steps.changed-files.outputs.diff_content, github.event.pull_request.title/body,
inputs.commit_sha) which allows script injection; fix by reading each untrusted
value into safe environment variables at the top of each run block (e.g.,
PR_TITLE, PR_BODY, CHANGED_FILES, DIFF_CONTENT, COMMIT_SHA) using the GitHub
expression only in the step's env mapping, then reference those env vars
(double-quoted) inside the script (use while IFS= read -r file; do ... done <<<
"$CHANGED_FILES" and printf '%s' "$CHANGED_FILES" when echoing), and for LLM
prompts write DIFF_CONTENT to a temporary file or wrap it in a clearly delimited
block rather than embedding raw content into YAML strings; apply this pattern to
the check-docs step, the commit/branch creation steps (git commit -m and gh pr
create usages), and any other run blocks that use those outputs.
| uses: anthropics/claude-code-action@beta | ||
| with: | ||
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| model: "claude-sonnet-4-5-20250929" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
anthropics/claude-code-action beta inputs direct_prompt allowed_tools anthropic_api_key 2026
💡 Result:
In the anthropics/claude-code-action beta version (pre-v1.0), the inputs direct_prompt and allowed_tools were used directly in GitHub Actions workflows, along with anthropic_api_key for authentication. Beta example: - uses: anthropics/claude-code-action@beta with: mode: "agent" direct_prompt: "Update the API documentation" anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} allowed_tools: "Edit,Read,Write" These inputs are deprecated in the stable v1.0 release. Migrate as follows: - direct_prompt → prompt - allowed_tools → claude_args: "--allowedTools Edit,Read,Write" - anthropic_api_key remains the same (required for direct API usage). v1.0 example: - uses: anthropics/claude-code-action@v1 with: prompt: "Update the API documentation" anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} claude_args: | --model claude-4-0-sonnet-20250805 --allowedTools Edit,Read,Write The action is no longer in beta as of v1.0 (GA release documented in 2026 sources). Use @v1 for current production workflows. anthropic_api_key is stored as a GitHub secret and passed via ${{ secrets.ANTHROPIC_API_KEY }}.
Citations:
- 1: https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
- 2: https://github.com/anthropics/claude-code-action
- 3: https://github.com/anthropics/claude-code-action/blob/eb99fb38/base-action/README.md
- 4: https://code.claude.com/docs/en/github-actions
🌐 Web query:
Anthropic Claude Sonnet 4.5 model id claude-sonnet-4-5-20250929 availability
💡 Result:
The Anthropic Claude Sonnet 4.5 model has the exact model ID claude-sonnet-4-5-20250929. It was released on September 29, 2025, and is generally available as of that date via the Claude API, Amazon Bedrock, Google Vertex AI, and third-party providers like Inworld. It remains available today (2026-04-23), listed in official Anthropic docs alongside newer models like Sonnet 4.6, with anticipated deprecation around September 2026. Use the alias claude-sonnet-4-5 for simplicity in the Claude API, or the full ID for version pinning. Pricing: $3 per million input tokens, $15 per million output tokens. Context: 200K tokens, max output 64K tokens. Capabilities include vision, function calling, reasoning, and agentic tasks.
Citations:
- 1: https://inworld.ai/models/anthropic-claude-sonnet-4-5-20250929
- 2: https://www.anthropic.com/news/claude-sonnet-4-5
- 3: https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude/sonnet-4-5
- 4: https://platform.claude.com/docs/en/about-claude/models/whats-new-sonnet-4-5
- 5: https://aws.amazon.com/blogs/aws/introducing-claude-sonnet-4-5-in-amazon-bedrock-anthropics-most-intelligent-model-best-for-coding-and-complex-agents/
- 6: https://docs.anthropic.com/en/docs/about-claude/models/whats-new-sonnet-4-5
- 7: https://platform.claude.com/docs/en/about-claude/models/overview
🏁 Script executed:
git ls-files '.github/workflows/docs-sync.yml'Repository: dojoengine/dojo.js
Length of output: 93
🏁 Script executed:
sed -n '80,95p' .github/workflows/docs-sync.ymlRepository: dojoengine/dojo.js
Length of output: 884
Update action to v1.0 stable and migrate inputs.
The model claude-sonnet-4-5-20250929 is available, and anthropic_api_key is still supported. However, direct_prompt is deprecated in the stable v1.0 release (migrated to prompt), and the action itself is no longer in beta. Using @beta risks silent breakage on upstream changes. Upgrade to anthropics/claude-code-action@v1 and update the input schema:
direct_prompt→prompt- Consider using
--model claude-sonnet-4-5-20250929viaclaude_argsif custom model pinning is required in v1.0.
🤖 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 85 - 88, The workflow is using
the beta action tag and deprecated input names; update the action reference from
"anthropics/claude-code-action@beta" to "anthropics/claude-code-action@v1",
replace any deprecated input "direct_prompt" with the new "prompt" input, keep
"anthropic_api_key" as-is, and if you need to pin the model move the model flag
into "claude_args" (e.g. "--model claude-sonnet-4-5-20250929") or use the new
model input per v1 schema instead of the current "model" field.
| git commit -m "docs: Update documentation for dojo.js commit ${{ github.event.inputs.commit_sha }} | ||
|
|
||
| Updates documentation to reflect changes made in commit: | ||
| ${{ github.event.inputs.commit_sha }} | ||
|
|
||
| Manually triggered documentation sync" | ||
| else | ||
| git commit -m "docs: Update documentation for dojo.js PR #${{ github.event.pull_request.number }} | ||
|
|
||
| Updates documentation to reflect changes made in: | ||
| ${{ github.event.pull_request.title }} | ||
|
|
||
| Related dojo.js PR: dojoengine/dojo.js#${{ github.event.pull_request.number }}" | ||
| fi | ||
|
|
||
| git push origin "$BRANCH_NAME" | ||
|
|
||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| gh pr create \ | ||
| --title "docs: Update documentation for dojo.js commit ${{ github.event.inputs.commit_sha }}" \ | ||
| --body "This PR updates the documentation to reflect changes made in dojoengine/dojo.js commit ${{ github.event.inputs.commit_sha }} | ||
|
|
||
| **Commit Details:** | ||
| - Commit SHA: ${{ github.event.inputs.commit_sha }} | ||
| - Files changed: ${{ steps.changed-files.outputs.changed_files }} | ||
| - Trigger: Manual documentation sync | ||
|
|
||
| Please review the documentation changes to ensure they accurately reflect the dojo.js updates." | ||
| gh pr merge --auto --squash | ||
| else | ||
| gh pr create \ | ||
| --title "docs: Update documentation for dojo.js PR #${{ github.event.pull_request.number }}" \ | ||
| --body "This PR updates the documentation to reflect changes made in dojoengine/dojo.js#${{ github.event.pull_request.number }} | ||
|
|
||
| **Original PR Details:** | ||
| - 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.js updates." | ||
| gh pr merge --auto --squash | ||
| fi |
There was a problem hiding this comment.
YAML indentation leaks into commit messages and PR bodies.
Because the strings on lines 145-148, 152-155, 165-170 and 177-181 are continuations of a double-quoted bash argument, every line after the first carries ~14 spaces of leading indentation from the YAML block scalar. The resulting commit/PR body looks like:
docs: Update documentation for dojo.js PR `#123`
Updates documentation to reflect changes made in:
<title>
Either dedent the continuation lines to column 0 (ugly in YAML but correct on GitHub) or build the message with a heredoc / printf fed from env vars:
- git commit -m "docs: Update documentation for dojo.js PR #${{ github.event.pull_request.number }}
-
- Updates documentation to reflect changes made in:
- ${{ github.event.pull_request.title }}
-
- Related dojo.js PR: dojoengine/dojo.js#${{ github.event.pull_request.number }}"
+ git commit -m "docs: Update documentation for dojo.js PR #${PR_NUMBER}" \
+ -m "Updates documentation to reflect changes made in:" \
+ -m "${PR_TITLE}" \
+ -m "Related dojo.js PR: dojoengine/dojo.js#${PR_NUMBER}"(Pairs well with moving these values into env: as suggested in the script-injection comment.)
🤖 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 143 - 183, The commit/PR
message strings passed to git commit -m and gh pr create are preserving YAML
indentation causing leading spaces in messages; replace those multi-line
double-quoted bash arguments with a dedented heredoc (e.g., build the message
via a cat <<EOF / printf fed from env vars) or construct the body using printf
and environment variables (github.event.inputs.commit_sha,
github.event.pull_request.number, github.event.pull_request.title,
steps.changed-files.outputs.changed_files, BRANCH_NAME) so the messages passed
to git commit and gh pr create are not indented by the YAML block; also consider
moving repeated values into env: and reference them when building the
heredoc/printf to keep the workflow readable.
75e216a to
3e12365
Compare
3e12365 to
d75615d
Compare
Ports the docs-sync workflow from cartridge-gg/controller to this repo. 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 the suggested docs updates. Requires repository secrets: CREATE_PR_TOKEN, ANTHROPIC_API_KEY.
d75615d to
1efbb97
Compare
|
Closed in favor of https://github.com/cartridge-gg/internal/pull/4422 |
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 manualworkflow_dispatch), the stub callsdojoengine/book/.github/workflows/docs-sync.yml@mainwith this repo's parameters (diff globs,DOCS_PATTERNS, canonical docs page). The shared workflow diffs the PR, runsanthropics/claude-code-action@betawith a tight "default to no changes / single canonical location / minimal edits" ruleset, and — if Claude made edits — opens an auto-merging PR todojoengine/bookwith the suggested changes.Per-repo parameters
See the
with:block in the diff. Canonical docs location for this repo:dojo.js: single-page
docs/pages/client/sdk/javascript.mdindojoengine/book.Requires these secrets (forwarded via
secrets: inherit)CREATE_PR_TOKEN— PAT withcontents: writeondojoengine/book.ANTHROPIC_API_KEY— foranthropics/claude-code-action@beta.Merge order
Merge
dojoengine/book#504first — that's what adds the reusable workflow this stub references. Merging this stub before that one means the workflow will fail at invocation time (theuses:ref won't resolve).Related
Companion stub PRs across the dojoengine ecosystem, all pointing at the same reusable workflow:
Cross-org companion stub: