Fetch PR body inside checker
test / test (pull_request) Successful in 8s

Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
2026-08-27 18:17:27 +00:00
parent f7daa3f025
commit 76c72b02e2
5 changed files with 72 additions and 21 deletions
+25 -6
View File
@@ -4,6 +4,7 @@ set -euo pipefail
connect_timeout=0
total_timeout=0
url=""
while [ "$#" -gt 0 ]; do
case "$1" in
--connect-timeout)
@@ -16,20 +17,38 @@ while [ "$#" -gt 0 ]; do
total_timeout=1
shift 2
;;
--header|--data-binary)
shift 2
;;
http*)
url="$1"
shift
;;
*) shift ;;
esac
done
[ "${connect_timeout}" -eq 1 ] && [ "${total_timeout}" -eq 1 ] || exit 2
if printf '%s\n' "${PR_BODY}" | grep -Fq '[[stall-renderer]]'; then
exit 28
fi
if printf '%s\n' "${PR_BODY}" | grep -Fq '<!--'; then
if [[ "${url}" == */api/v1/repos/action/check-naming/pulls/1 ]]; then
if [ -n "${TEST_PR_BODY_FILE:-}" ]; then
jq -Rs '{body: .}' < "${TEST_PR_BODY_FILE}"
else
printf '%s' "${PR_BODY:-}" | jq -Rs '{body: .}'
fi
exit 0
fi
printf '%s\n' "${PR_BODY}" | awk '
BODY=$(jq -r '.Text')
if printf '%s\n' "${BODY}" | grep -Fq '[[stall-renderer]]'; then
exit 28
fi
if printf '%s\n' "${BODY}" | grep -Fq '<!--'; then
exit 0
fi
printf '%s\n' "${BODY}" | awk '
{
line=$0
lower=tolower(line)