fix:NT原生PC 两处小修复(箱庭Pin3 green_mask补漏 + 快速狩猎MAX回退OCR动态) #172
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Real-time Notification | |
| on: | |
| # 使用 pull_request_target:在基仓上下文运行,fork 发起的 PR 也能读取仓库密文。 | |
| # 注意:本工作流不 checkout/执行 PR 代码,仅读取事件元数据,故 pull_request_target 安全。 | |
| pull_request_target: | |
| types: [opened, closed, reopened] | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| pr-notification: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Prepare PR Message | |
| id: prepare_msg | |
| env: | |
| # 事件字段统一经 env 注入,避免将用户可控内容(如 PR 标题)直接拼进 shell 造成脚本注入 | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_USER: ${{ github.event.pull_request.user.login }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| PR_ACTION: ${{ github.event.action }} | |
| PR_MERGED: ${{ github.event.pull_request.merged }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| # --- 1. 基础变量已由上方 env 注入(PR_TITLE / PR_USER / PR_NUMBER / PR_URL / PR_ACTION / PR_MERGED / HEAD_REF / BASE_REF / REPO) --- | |
| # --- 2. 判断逻辑 --- | |
| # 默认为更新状态 | |
| ACTION_EMOJI="📝" | |
| ACTION_TEXT="更新了 PR" | |
| STATUS_INFO="" | |
| if [ "$PR_ACTION" == "opened" ] || [ "$PR_ACTION" == "reopened" ]; then | |
| # [场景:发起/重开 PR] | |
| if [ "$PR_ACTION" == "opened" ]; then | |
| ACTION_EMOJI="🔀" | |
| ACTION_TEXT="发起了 Pull Request" | |
| else | |
| ACTION_EMOJI="🔄" | |
| ACTION_TEXT="重新开启了 PR" | |
| fi | |
| STATUS_INFO="| 🌿 分支: $HEAD_REF -> $BASE_REF" | |
| elif [ "$PR_ACTION" == "closed" ]; then | |
| # [场景:关闭 PR] | |
| # 必须判断是“合并关闭”还是“取消关闭” | |
| if [ "$PR_MERGED" == "true" ]; then | |
| ACTION_EMOJI="🟣" | |
| ACTION_TEXT="合并了 PR (Accepted)" | |
| STATUS_INFO="| 🌿 合并至: $BASE_REF" | |
| else | |
| ACTION_EMOJI="🚫" | |
| ACTION_TEXT="关闭了 PR (Discarded)" | |
| fi | |
| fi | |
| # --- 3. 组装消息 --- | |
| # 标题行 | |
| TITLE="$ACTION_EMOJI [$REPO] $ACTION_TEXT" | |
| # 内容详情 | |
| CONTENT="标题: $PR_TITLE" | |
| CONTENT="$CONTENT | 作者: $PR_USER" | |
| CONTENT="$CONTENT | 编号: #$PR_NUMBER" | |
| # 追加分支信息(如果有) | |
| if [ -n "$STATUS_INFO" ]; then | |
| CONTENT="$CONTENT $STATUS_INFO" | |
| fi | |
| CONTENT="$CONTENT | 🔗 链接: $PR_URL" | |
| # --- 4. 输出到环境变量 --- | |
| echo "title=$TITLE" >> $GITHUB_OUTPUT | |
| echo "content=$CONTENT" >> $GITHUB_OUTPUT | |
| # 打印日志方便调试 | |
| echo "生成消息: $TITLE" | |
| echo "详情: $CONTENT" | |
| - name: Send QQ Notification | |
| uses: Y2Nk4/qmsg-action@ce43bda34f1ba6668ff43ba8d0ad465d1c959723 # master | |
| with: | |
| # qq: ${{ needs.meta.outputs.version_type == 'ci' && secrets.QMSG_QQ_DEV || secrets.QMSG_QQ_PUB }} | |
| # groups: ${{ needs.meta.outputs.version_type == 'ci' && secrets.QMSG_GROUPS_DEV || secrets.QMSG_GROUPS_PUB }} | |
| groups: ${{ secrets.QMSG_GROUPS_DEV }} | |
| key: ${{ secrets.QMSG_KEY }} | |
| message: | | |
| ${{ steps.prepare_msg.outputs.title }} | |
| ${{ steps.prepare_msg.outputs.content }} |