Fix run condition for PR

This commit is contained in:
Aoran Zeng 2025-06-28 15:58:13 +08:00
parent 6120d98688
commit c53bd62534
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -4,7 +4,7 @@
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2025-06-19> # Created On : <2025-06-19>
# Last Modified : <2025-06-20> # Last Modified : <2025-06-28>
# #
# Notify PR # Notify PR
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -22,7 +22,8 @@ jobs:
enforce-dev-branch: enforce-dev-branch:
name: 强制使用dev分支 name: 强制使用dev分支
runs-on: ubuntu-latest 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: steps:
- name: 评论 - name: 评论
uses: thollander/actions-comment-pull-request@v3 uses: thollander/actions-comment-pull-request@v3
@ -31,17 +32,13 @@ jobs:
❤️ 感谢你的贡献!你的 PR 当前基于 ${{github.base_ref}} 分支,请修改使用 `dev` 分支! ❤️ 感谢你的贡献!你的 PR 当前基于 ${{github.base_ref}} 分支,请修改使用 `dev` 分支!
comment-tag: "❤️ 感谢你的贡献!" comment-tag: "❤️ 感谢你的贡献!"
- run: | - 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}" echo "::error::❌ PR 必须以 dev 分支为目标!当前是 ${GITHUB_BASE_REF}"
exit 1 exit 1
welcome: welcome:
name: 欢迎PR者 name: 欢迎PR者
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request_target.base.ref == 'dev' if: github.event.pull_request.base.ref == 'dev'
steps: steps:
- name: 评论 - name: 评论
if: github.event.pull_request.type == 'opened' if: github.event.pull_request.type == 'opened'