-
Notifications
You must be signed in to change notification settings - Fork 452
feat: add auto-build-main-module-docs and auto-deploy-docs yml #1732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||||||||||||||||||||||
| name: Auto Build Main Module Docs | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||
| branches: [develop] | ||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||
| - 'docs/**' | ||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||
| branches: [develop] | ||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||
| - 'docs/**' | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| verify-main-build: | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - uses: webfactory/[email protected] | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| ssh-private-key: ${{ secrets.SUBMODULE_SSH_KEY_PRIVATE }} | ||||||||||||||||||||||||||
wuyiping0628 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
| - 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-main | ||||||||||||||||||||||||||
| cd docs-main | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # 更新子模块到PR分支的版本 | ||||||||||||||||||||||||||
| git submodule sync --recursive | ||||||||||||||||||||||||||
| git submodule update --init --recursive | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # 获取PR分支的最新提交 | ||||||||||||||||||||||||||
| cd ./tiny-engine | ||||||||||||||||||||||||||
| BRANCH_NAME="${{ github.head_ref }}" | ||||||||||||||||||||||||||
| git fetch origin $BRANCH_NAME | ||||||||||||||||||||||||||
| git checkout $BRANCH_NAME | ||||||||||||||||||||||||||
|
Comment on lines
+43
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix script injection vulnerability. Using 🔎 Recommended fix - name: Checkout main repository
run: |
# 克隆主仓库
git clone https://github.com/opentiny/docs.git docs-main
cd docs-main
# 更新子模块到PR分支的版本
git submodule sync --recursive
git submodule update --init --recursive
# 获取PR分支的最新提交
cd ./tiny-engine
- BRANCH_NAME="${{ github.head_ref }}"
- git fetch origin $BRANCH_NAME
- git checkout $BRANCH_NAME
+ git fetch origin "$BRANCH_NAME"
+ git checkout "$BRANCH_NAME"
# 回到主仓库根目录
cd ../
+ env:
+ BRANCH_NAME: ${{ github.head_ref }}Based on the static analysis hint provided. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # 回到主仓库根目录 | ||||||||||||||||||||||||||
| cd ../ | ||||||||||||||||||||||||||
wuyiping0628 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Setup pnpm | ||||||||||||||||||||||||||
| uses: pnpm/action-setup@v3 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| version: 9 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run main repo build | ||||||||||||||||||||||||||
| id: build | ||||||||||||||||||||||||||
| working-directory: ./docs-main | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| pnpm i | ||||||||||||||||||||||||||
| # 如果使用VitePress | ||||||||||||||||||||||||||
| pnpm build | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Update PR status | ||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| # 检查构建是否成功 | ||||||||||||||||||||||||||
| if [ ${{ steps.build.outcome }} == 'success' ]; then | ||||||||||||||||||||||||||
wuyiping0628 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
| echo "✅ 主仓库构建成功" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "❌ 主仓库构建失败" | ||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Auto Deploy Docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: [develop] | ||
| paths: | ||
| - 'docs/**' | ||
|
|
||
| jobs: | ||
| notify: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Trigger main repo workflow | ||
| env: | ||
| PAT: ${{ secrets.PAT_TOKEN }} | ||
| run: | | ||
| curl -X POST \ | ||
| -H "Authorization: token $PAT" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| https://api.github.com/repos/opentiny/docs/dispatches \ | ||
| -d '{"event_type":"submodule-updated"}' | ||
wuyiping0628 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要包含release分支, ==>
[develop, release/*]