From c53bd62534b2985c200369b670d5fb2cb8a5f33c Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sat, 28 Jun 2025 15:58:13 +0800 Subject: [PATCH] Fix run condition for PR --- .github/workflows/PR-notify.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/PR-notify.yml b/.github/workflows/PR-notify.yml index 5c6b75f..bbf2e13 100644 --- a/.github/workflows/PR-notify.yml +++ b/.github/workflows/PR-notify.yml @@ -4,7 +4,7 @@ # Contributors : Nul None # | # Created On : <2025-06-19> -# Last Modified : <2025-06-20> +# Last Modified : <2025-06-28> # # Notify PR # --------------------------------------------------------------- @@ -22,7 +22,8 @@ jobs: enforce-dev-branch: name: 强制使用dev分支 runs-on: ubuntu-latest - if: github.event.pull_request_target.base.ref != 'dev' + # github.event.pull_request_target 内容为空,转而用 pull_request + if: github.event.pull_request.base.ref != 'dev' steps: - name: 评论 uses: thollander/actions-comment-pull-request@v3 @@ -31,17 +32,13 @@ jobs: ❤️ 感谢你的贡献!你的 PR 当前基于 ${{github.base_ref}} 分支,请修改使用 `dev` 分支! comment-tag: "❤️ 感谢你的贡献!" - run: | - echo "github.event.pull_request_target.base.label = [${{github.event.pull_request_target.base.label}}]" - echo "github.event.pull_request_target.base.ref = [${{github.event.pull_request_target.base.ref}}]" - echo "github.event.pull_request.base.label = [${{github.event.pull_request.base.label}}]" - echo "github.event.pull_request.base.ref = [${{github.event.pull_request.base.ref}}]" echo "::error::❌ PR 必须以 dev 分支为目标!当前是 ${GITHUB_BASE_REF}" exit 1 welcome: name: 欢迎PR者 runs-on: ubuntu-latest - if: github.event.pull_request_target.base.ref == 'dev' + if: github.event.pull_request.base.ref == 'dev' steps: - name: 评论 if: github.event.pull_request.type == 'opened'