Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
@@ -11,90 +11,6 @@ BODY="${PR_BODY:-}"
|
||||
BASE="${BASE_SHA:-}"
|
||||
HEAD="${HEAD_SHA:-}"
|
||||
|
||||
# Gitea renders HTML comments as hidden. Validate the visible body so required
|
||||
# tracking and attribution cannot exist only in comment source.
|
||||
VISIBLE_BODY=$(printf '%s\n' "${BODY}" | awk '
|
||||
{
|
||||
line=$0
|
||||
fence_pos=1
|
||||
while (fence_pos <= 3 && substr(line, fence_pos, 1) == " ") fence_pos++
|
||||
fence_char=substr(line, fence_pos, 1)
|
||||
fence_run=0
|
||||
if (fence_char == "`" || fence_char == "~") {
|
||||
while (substr(line, fence_pos + fence_run, 1) == fence_char) fence_run++
|
||||
}
|
||||
if (!in_comment && in_fence) {
|
||||
print line
|
||||
if (fence_char == active_fence_char && fence_run >= active_fence_run) in_fence=0
|
||||
next
|
||||
}
|
||||
fence_info=substr(line, fence_pos + fence_run)
|
||||
valid_fence_info=(fence_char == "~" || index(fence_info, "`") == 0)
|
||||
if (!in_comment && fence_run >= 3 && valid_fence_info) {
|
||||
in_fence=1
|
||||
active_fence_char=fence_char
|
||||
active_fence_run=fence_run
|
||||
print line
|
||||
next
|
||||
}
|
||||
|
||||
visible=""
|
||||
pos=1
|
||||
backslash_run=0
|
||||
while (pos <= length(line)) {
|
||||
if (in_comment) {
|
||||
rest=substr(line, pos)
|
||||
comment_end=index(rest, "-->")
|
||||
if (comment_end == 0) {
|
||||
pos=length(line) + 1
|
||||
break
|
||||
}
|
||||
visible=visible " "
|
||||
pos += comment_end + 2
|
||||
in_comment=0
|
||||
backslash_run=0
|
||||
continue
|
||||
}
|
||||
|
||||
if (substr(line, pos, 1) == "`" && backslash_run % 2 == 0) {
|
||||
ticks=1
|
||||
while (substr(line, pos + ticks, 1) == "`") ticks++
|
||||
close_pos=pos + ticks
|
||||
found_close=0
|
||||
while (close_pos <= length(line)) {
|
||||
if (substr(line, close_pos - 1, 1) != "`" &&
|
||||
substr(line, close_pos, ticks) == substr(line, pos, ticks) &&
|
||||
substr(line, close_pos + ticks, 1) != "`") {
|
||||
found_close=1
|
||||
break
|
||||
}
|
||||
close_pos++
|
||||
}
|
||||
if (found_close) {
|
||||
visible=visible substr(line, pos, close_pos + ticks - pos)
|
||||
pos=close_pos + ticks
|
||||
backslash_run=0
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (substr(line, pos, 4) == "<!--") {
|
||||
visible=visible " "
|
||||
in_comment=1
|
||||
pos += 4
|
||||
backslash_run=0
|
||||
continue
|
||||
}
|
||||
char=substr(line, pos, 1)
|
||||
visible=visible char
|
||||
if (char == "\\") backslash_run++
|
||||
else backslash_run=0
|
||||
pos++
|
||||
}
|
||||
print visible
|
||||
}
|
||||
')
|
||||
|
||||
# Break-glass: dfritz is exempt from all naming checks.
|
||||
if [ "${AUTHOR}" = "dfritz" ]; then
|
||||
echo "check-naming: dfritz break-glass — exempt"
|
||||
@@ -105,6 +21,15 @@ FAILED=0
|
||||
BRANCH_KIND="invalid"
|
||||
BRANCH_BUG=""
|
||||
|
||||
# Gitea hides HTML comments. Reject their delimiters so required provenance is
|
||||
# always visible, then parse the raw body without a second Markdown renderer.
|
||||
VISIBLE_BODY="${BODY}"
|
||||
if printf '%s\n' "${BODY}" | grep -Fq '<!--' ||
|
||||
printf '%s\n' "${BODY}" | grep -Fq -- '-->'; then
|
||||
echo "FAIL[check-naming]: PR body must not contain HTML comment delimiters"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
# ---- branch form ----
|
||||
# <role>/bug-<id>/<kebab>
|
||||
if echo "${BRANCH}" | grep -qE "^(dev|ux|ops|security|perf|architect|support)/bug-[a-z0-9]+/[a-z0-9][a-z0-9-]*$"; then
|
||||
|
||||
Reference in New Issue
Block a user