Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/auto-build-main-module-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Auto Build Main Module Docs

on:
pull_request:
branches: [dev]
push:
branches: [dev]

jobs:
verify-main-build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SUBMODULE_SSH_KEY }}
- name: Checkout submodule repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}

- name: Checkout main repository
run: |
# 克隆主仓库
git clone https://github.com/opentiny/docs.git docs
cd docs

# 更新子模块到PR分支的版本
git submodule sync --recursive
git submodule update --init --recursive


# 获取PR分支的最新提交
cd ./tiny-vue
BRANCH_NAME="${{ github.head_ref }}"
git fetch origin $BRANCH_NAME
git checkout $BRANCH_NAME

# 回到主仓库根目录
cd ../

# 更新主仓库中的子模块引用
git add tiny-vue
git commit -m "Update submodule to PR version" || echo "No changes"

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- name: Run main repo build
id: build
working-directory: ./docs
run: |
pnpm i
# 如果使用VitePress
pnpm build

- name: Update PR status
if: always()
run: |
# 检查构建是否成功
if [ ${{ steps.build.outcome }} == 'success' ]; then
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Quote the workflow expression in shell test for robustness.

The unquoted expression ${{ steps.build.outcome }} could cause a syntax error if the value is empty or contains unexpected characters.

Apply this diff:

-        if [ ${{ steps.build.outcome }} == 'success' ]; then
+        if [ "${{ steps.build.outcome }}" == "success" ]; then
📝 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
if [ ${{ steps.build.outcome }} == 'success' ]; then
if [ "${{ steps.build.outcome }}" == "success" ]; then
🤖 Prompt for AI Agents
.github/workflows/auto-build-main-module-docs.yml around line 67: the shell test
uses an unquoted workflow expression (${{
steps.build.outcome }}) which can cause syntax errors if empty or contains
spaces; update the test to wrap the expression in quotes so the shell sees a
single word (e.g., quote the substituted value on both sides of the comparison)
to make the condition robust and prevent failures when the variable is empty or
has special characters.

echo "✅ 主仓库构建成功"
else
echo "❌ 主仓库构建失败"
exit 1
fi
Loading