36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REPORT_PATH="${1:?review report path required}"
|
|
|
|
NEXT_BLOCK="$(python3 - <<'PY' "$REPORT_PATH"
|
|
from pathlib import Path
|
|
import sys
|
|
text = Path(sys.argv[1]).read_text(encoding='utf-8')
|
|
lines = text.splitlines()
|
|
inside = False
|
|
buf = []
|
|
for line in lines:
|
|
if line.startswith('## '):
|
|
if inside:
|
|
break
|
|
inside = line.strip() == '## Next'
|
|
continue
|
|
if inside:
|
|
buf.append(line)
|
|
print('\n'.join(buf))
|
|
PY
|
|
)"
|
|
|
|
if [[ -z "${NEXT_BLOCK//[[:space:]]/}" ]]; then
|
|
echo "missing actionable next step: ## Next block is empty" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! printf '%s\n' "$NEXT_BLOCK" | grep -Eq '(^- .*处理|^- .*修复|^- .*新增|^- .*更新|^- .*验证|^- .*运行|^- .*同步|^- .*接入|^- .*排查|^[0-9]+\..*(处理|修复|新增|更新|验证|运行|同步|接入|排查)|处理问题|修复问题|新增.*guard|接入.*链)'; then
|
|
echo "missing actionable next step: ## Next does not contain executable action" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "REVIEW_ACTION_GUARD: PASS"
|