fix(ci): 解析 Issue 编号时 grep 无匹配导致 step 退出
PR 描述中无 Closes/Fixes/Resolves #N 时,grep 返回 1,set -e 导致脚本 在未执行分支名回退逻辑前即退出。为管道添加 || true,使无匹配时继续 从分支名 ai_fix/N_xxx 解析 Issue 编号。 Made-with: Cursor
This commit is contained in:
@@ -25,8 +25,8 @@ jobs:
|
||||
BODY="${{ github.event.pull_request.body }}"
|
||||
HEAD_REF="${{ github.event.pull_request.head.ref }}"
|
||||
|
||||
# 优先从 PR 描述解析
|
||||
ISSUE_NUM=$(echo "$BODY" | grep -oE '(Closes|Fixes|Resolves) #([0-9]+)' | head -1 | grep -oE '[0-9]+')
|
||||
# 优先从 PR 描述解析(无匹配时 grep 会 exit 1,需 || true 避免 set -e 导致脚本退出)
|
||||
ISSUE_NUM=$(echo "$BODY" | grep -oE '(Closes|Fixes|Resolves) #([0-9]+)' | head -1 | grep -oE '[0-9]+' || true)
|
||||
if [ -z "$ISSUE_NUM" ]; then
|
||||
# 从分支名解析 ai_fix/N_xxx
|
||||
ISSUE_NUM=$(echo "$HEAD_REF" | sed -n 's|^ai_fix/\([0-9]*\)_.*|\1|p')
|
||||
|
||||
Reference in New Issue
Block a user