From 666a1fa28e73dcb3e9790cba192ce04f7bce2a2c Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Mon, 6 Apr 2026 11:40:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(workflow):=20=E6=9B=B4=E6=96=B0=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=A8=8B=E4=BB=A5=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=9C=A8=E6=8E=A8=E9=80=81=E5=92=8C=20PR=20=E4=B8=AD?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=A7=A6=E5=8F=91=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b166bd85..42125cac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,10 +3,18 @@ name: Deploy VitePress site to Pages on: - # 在针对 `main` 分支的推送上运行。如果你 - # 使用 `master` 分支作为默认分支,请将其更改为 `master` + # 在 docs 相关变更推送时运行构建(任意分支) push: + paths: + - 'docs/**' + - '.github/workflows/deploy.yml' + + # 在面向 main 的 PR 中提前验证 docs 构建 + pull_request: branches: [main] + paths: + - 'docs/**' + - '.github/workflows/deploy.yml' # 允许你从 Actions 选项卡手动运行此工作流程 workflow_dispatch: @@ -51,6 +59,7 @@ jobs: # 部署工作 deploy: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}