Skip to content

Conversation

@wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Dec 31, 2025

Summary by CodeRabbit

  • Chores

    • Set up automated documentation workflows that build and deploy documentation when changes are committed to release branches, validate successful builds, and automatically notify the documentation repository to keep all documentation synchronized and up-to-date
  • Documentation

    • Enhanced code block formatting and spacing in the plugin badge documentation guide to improve clarity and user experience

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Walkthrough

This PR introduces two new GitHub Actions workflows for documentation automation: one builds the main module docs on PR changes under docs/**, and another notifies the docs repository on release branch pushes. A formatting fix adds spacing to code blocks in documentation markdown.

Changes

Cohort / File(s) Summary
Documentation Automation Workflows
.github/workflows/auto-build-main-module-docs.yml, .github/workflows/auto-deploy-docs.yml
Two new GitHub Actions workflows: first triggers on docs/** changes to build main module docs via SSH-authenticated submodule access and pnpm; second triggers on release/v0.3.x pushes to notify the docs repository via API dispatch event.
Documentation Formatting
docs/src/guide/plugin-badge.md
Adds blank lines immediately after opening code fence (```typescript) in two code blocks for improved readability.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A workflow springs up in the night,
Building docs with automated might,
When branches change, the robots dance,
Syncing submodules at a glance—
Tiny-robot hops with care,
Keeping docs fresh in the air! 🚀

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main changes in the changeset, which introduces two new GitHub Actions workflow files (auto-build-main-module-docs.yml and auto-deploy-docs.yml).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@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

🧹 Nitpick comments (2)
.github/workflows/auto-build-main-module-docs.yml (2)

30-48: Add error handling for git operations.

Git operations can fail for various reasons (network issues, authentication problems, branch not found). Consider adding error checking to fail fast and provide clear feedback.

🔎 Proposed refactor with error handling
       - name: Checkout main repository
         run: |
+          set -e  # Exit on any error
+          
           # 克隆主仓库
-          git clone https://github.com/opentiny/docs.git docs-main
+          git clone https://github.com/opentiny/docs.git docs-main || {
+            echo "❌ Failed to clone main docs repository"
+            exit 1
+          }
           cd docs-main

           # 更新子模块到PR分支的版本
-          git submodule sync --recursive
-          git submodule update --init --recursive
+          git submodule sync --recursive || {
+            echo "❌ Failed to sync submodules"
+            exit 1
+          }
+          git submodule update --init --recursive || {
+            echo "❌ Failed to update submodules"
+            exit 1
+          }

           # 获取PR分支的最新提交
           cd ./tiny-robot
           
           # Use head_ref for PRs, ref_name for pushes
           if [ -n "$BRANCH_NAME" ]; then
-            git fetch origin "$BRANCH_NAME"
-            git checkout "$BRANCH_NAME"
+            git fetch origin "$BRANCH_NAME" || {
+              echo "❌ Failed to fetch PR branch: $BRANCH_NAME"
+              exit 1
+            }
+            git checkout "$BRANCH_NAME" || {
+              echo "❌ Failed to checkout PR branch: $BRANCH_NAME"
+              exit 1
+            }
+            echo "✅ Checked out PR branch: $BRANCH_NAME"
           else
-            git fetch origin "$PUSH_REF"
-            git checkout "$PUSH_REF"
+            git fetch origin "$PUSH_REF" || {
+              echo "❌ Failed to fetch push ref: $PUSH_REF"
+              exit 1
+            }
+            git checkout "$PUSH_REF" || {
+              echo "❌ Failed to checkout push ref: $PUSH_REF"
+              exit 1
+            }
+            echo "✅ Checked out push ref: $PUSH_REF"
           fi

           # 回到主仓库根目录
           cd ../
+        env:
+          BRANCH_NAME: ${{ github.head_ref }}
+          PUSH_REF: ${{ github.ref_name }}

55-61: Consider adding build output capture for debugging.

While the build step correctly reports success/failure, capturing build output would help diagnose failures. Consider redirecting output to a file or using tee for better troubleshooting.

🔎 Proposed enhancement for build logging
       - name: Run main repo build
         id: build
         working-directory: ./docs-main
         run: |
-          pnpm i
+          echo "Installing dependencies..."
+          pnpm i 2>&1 | tee build-install.log
+          
           # 如果使用VitePress
-          pnpm build
+          echo "Building documentation..."
+          pnpm build 2>&1 | tee build-output.log
+          
+      - name: Upload build logs on failure
+        if: failure()
+        uses: actions/upload-artifact@v4
+        with:
+          name: build-logs
+          path: |
+            docs-main/build-install.log
+            docs-main/build-output.log
+          retention-days: 7
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3299a5 and 75566fa.

📒 Files selected for processing (3)
  • .github/workflows/auto-build-main-module-docs.yml
  • .github/workflows/auto-deploy-docs.yml
  • docs/src/guide/plugin-badge.md
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/auto-build-main-module-docs.yml

31-31: "github.head_ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details

(expression)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build / build
  • GitHub Check: verify-main-build
🔇 Additional comments (1)
docs/src/guide/plugin-badge.md (1)

12-12: LGTM! Formatting improvement.

The empty line after the code fence improves readability without affecting functionality.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

✅ Preview build completed successfully!

Click the image above to preview.
Preview will be automatically removed when this PR is closed.

@github-actions
Copy link
Contributor

@kagol kagol merged commit 67a16b1 into release/v0.3.x Dec 31, 2025
5 checks passed
@github-actions
Copy link
Contributor

🧹 Preview Cleaned Up

The preview deployment has been removed.

SonyLeo pushed a commit to SonyLeo/tiny-robot that referenced this pull request Jan 8, 2026
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.

3 participants