Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,24 @@ jobs:
# comments endpoint (PR comments live there) and jq-filter
# by marker presence. `head -1` defends against the
# (impossible-but-cheap-to-guard) double-managed-comment case.
#
# A transient GitHub API error (e.g. a 503) makes `gh api`
# print its JSON error body to stdout while still exiting
# non-zero; the `|| true` swallows the exit code but not
# that body, so EXISTING_ID could otherwise become garbage
# text instead of a real comment id — which then crashes the
# DELETE/PATCH call below and fails this *required* gate for
# a reason unrelated to title conformance. Validate the
# result is purely numeric (a real id always is) and treat
# anything else as "no existing comment found".
EXISTING_ID=$(
gh api --paginate "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \
--jq ".[] | select(.body | contains(\"${COMMENT_MARKER}\")) | .id" \
| head -1 || true
)
if ! [[ "${EXISTING_ID}" =~ ^[0-9]+$ ]]; then
EXISTING_ID=""
fi

if echo "$TITLE" | grep -qE "$PATTERN"; then
# ── Conforming title ───────────────────────────────────
Expand Down
Loading