38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BACKLOG_PATH="${1:?backlog path required}"
|
|
|
|
python3 - <<'PY' "$BACKLOG_PATH"
|
|
from pathlib import Path
|
|
import re
|
|
import sys
|
|
|
|
text = Path(sys.argv[1]).read_text(encoding='utf-8')
|
|
lines = text.splitlines()
|
|
inside = False
|
|
current_rows = []
|
|
for line in lines:
|
|
if line.startswith('## 当前未修复问题速查表'):
|
|
inside = True
|
|
continue
|
|
if inside and line.startswith('---'):
|
|
break
|
|
if inside and line.startswith('|') and not line.startswith('| #') and not line.startswith('|---'):
|
|
current_rows.append(line)
|
|
|
|
matches = re.findall(r'freshness_hint=same-day-blocker-switch old=([^ ]+) new=([^\n ]+)', text)
|
|
for old, new in matches:
|
|
old_variants = {
|
|
old.lower(),
|
|
old.replace('-', ' ').lower(),
|
|
old.replace(' ', '-').lower(),
|
|
}
|
|
for row in current_rows:
|
|
row_lower = row.lower()
|
|
if any(variant and variant in row_lower for variant in old_variants):
|
|
print('stale blocker still present in current table', file=sys.stderr)
|
|
raise SystemExit(1)
|
|
print('BACKLOG_BLOCKER_FRESHNESS_GUARD: PASS')
|
|
PY
|