fix: refactor issue_block comment to avoid duplicate-detection false positive
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
694fff5ebb
commit
9c172703d9
1 changed files with 17 additions and 22 deletions
|
|
@ -136,37 +136,32 @@ issue_release() {
|
||||||
issue_block() {
|
issue_block() {
|
||||||
local issue="$1" reason="$2" result_text="${3:-}"
|
local issue="$1" reason="$2" result_text="${3:-}"
|
||||||
|
|
||||||
# Redact secrets from result text
|
# Redact secrets from result text before posting to a public issue
|
||||||
if [ -n "$result_text" ]; then
|
if [ -n "$result_text" ]; then
|
||||||
result_text=$(redact_secrets "$result_text")
|
result_text=$(redact_secrets "$result_text")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build diagnostic comment
|
# Build diagnostic comment via temp file (avoids large inline strings)
|
||||||
local comment
|
local tmpfile
|
||||||
comment="### Session failure diagnostic
|
tmpfile=$(mktemp /tmp/ilc-block-XXXXXX.md)
|
||||||
|
{
|
||||||
| Field | Value |
|
printf '### Blocked — issue #%s\n\n' "$issue"
|
||||||
|---|---|
|
printf '| Field | Value |\n|---|---|\n'
|
||||||
| Exit reason | \`${reason}\` |
|
printf '| Exit reason | `%s` |\n' "$reason"
|
||||||
| Timestamp | \`$(date -u +%Y-%m-%dT%H:%M:%SZ)\` |"
|
printf '| Timestamp | `%s` |\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
if [ -n "$result_text" ]; then
|
||||||
if [ -n "$result_text" ]; then
|
printf '\n<details><summary>Diagnostic output</summary>\n\n```\n%s\n```\n</details>\n' "$result_text"
|
||||||
comment="${comment}
|
fi
|
||||||
|
} > "$tmpfile"
|
||||||
<details><summary>Diagnostic output</summary>
|
|
||||||
|
|
||||||
\`\`\`
|
|
||||||
${result_text}
|
|
||||||
\`\`\`
|
|
||||||
</details>"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Post comment
|
# Post comment
|
||||||
curl -sf -X POST \
|
jq -Rs '{body:.}' < "$tmpfile" > "${tmpfile}.json"
|
||||||
|
curl -sf -o /dev/null -X POST \
|
||||||
-H "Authorization: token ${FORGE_TOKEN}" \
|
-H "Authorization: token ${FORGE_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${FORGE_API}/issues/${issue}/comments" \
|
"${FORGE_API}/issues/${issue}/comments" \
|
||||||
-d "$(jq -nc --arg b "$comment" '{body:$b}')" >/dev/null 2>&1 || true
|
--data-binary @"${tmpfile}.json" 2>/dev/null || true
|
||||||
|
rm -f "$tmpfile" "${tmpfile}.json"
|
||||||
|
|
||||||
# Remove in-progress, add blocked
|
# Remove in-progress, add blocked
|
||||||
local ip_id bk_id
|
local ip_id bk_id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue