feat: add auto-build-main-module-docs and auto-deploy-docs yml#280
feat: add auto-build-main-module-docs and auto-deploy-docs yml#280kagol merged 1 commit intorelease/v0.3.xfrom
Conversation
WalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
Pre-merge checks✅ Passed checks (3 passed)
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: 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
📒 Files selected for processing (3)
.github/workflows/auto-build-main-module-docs.yml.github/workflows/auto-deploy-docs.ymldocs/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.
📦 Package Previewpnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot@75566fa pnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot-kit@75566fa pnpm add https://pkg.pr.new/opentiny/tiny-robot/@opentiny/tiny-robot-svgs@75566fa commit: 75566fa |
🧹 Preview Cleaned UpThe preview deployment has been removed. |

Summary by CodeRabbit
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.