Compare commits
1 commit
ef00850dbe
...
a2bfe1aa82
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2bfe1aa82 |
2 changed files with 30 additions and 22 deletions
|
|
@ -125,7 +125,7 @@ open_pr_exists() {
|
||||||
|
|
||||||
# Relabel a stale in-progress issue to blocked with diagnostic comment
|
# Relabel a stale in-progress issue to blocked with diagnostic comment
|
||||||
# Args: issue_number reason
|
# Args: issue_number reason
|
||||||
# Returns: 0 on success, 1 on failure
|
# Uses shared helpers from lib/issue-lifecycle.sh
|
||||||
relabel_stale_issue() {
|
relabel_stale_issue() {
|
||||||
local issue="$1" reason="$2"
|
local issue="$1" reason="$2"
|
||||||
|
|
||||||
|
|
@ -149,25 +149,17 @@ relabel_stale_issue() {
|
||||||
-d "{\"labels\":[${bk_id}]}" >/dev/null 2>&1 || true
|
-d "{\"labels\":[${bk_id}]}" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Post diagnostic comment
|
# Post diagnostic comment using shared helper
|
||||||
local tmpfile
|
local comment_body
|
||||||
tmpfile=$(mktemp /tmp/stale-issue-XXXXXX.md)
|
comment_body=$(
|
||||||
{
|
|
||||||
printf '### Stale in-progress issue detected\n\n'
|
printf '### Stale in-progress issue detected\n\n'
|
||||||
printf '| Field | Value |\n|---|---|\n'
|
printf '| Field | Value |\n|---|---|\n'
|
||||||
printf '| Detection reason | `%s` |\n' "$reason"
|
printf '| Detection reason | `%s` |\n' "$reason"
|
||||||
printf '| Timestamp | `%s` |\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
printf '| Timestamp | `%s` |\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
printf '\n**Status:** This issue was labeled `in-progress` but no active tmux session exists.\n'
|
printf '\n**Status:** This issue was labeled `in-progress` but no active tmux session exists.\n'
|
||||||
printf '**Action required:** A maintainer should triage this issue.\n'
|
printf '**Action required:** A maintainer should triage this issue.\n'
|
||||||
} > "$tmpfile"
|
)
|
||||||
|
_ilc_post_comment "$issue" "$comment_body"
|
||||||
jq -Rs '{body:.}' < "$tmpfile" > "${tmpfile}.json"
|
|
||||||
curl -sf -o /dev/null -X POST \
|
|
||||||
-H "Authorization: token ${FORGE_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${API}/issues/${issue}/comments" \
|
|
||||||
--data-binary @"${tmpfile}.json" 2>/dev/null || true
|
|
||||||
rm -f "$tmpfile" "${tmpfile}.json"
|
|
||||||
|
|
||||||
_ilc_log "stale issue #${issue} relabeled to blocked: ${reason}"
|
_ilc_log "stale issue #${issue} relabeled to blocked: ${reason}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,27 @@ issue_release() {
|
||||||
_ilc_log "released issue #${issue}"
|
_ilc_log "released issue #${issue}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# _ilc_post_comment — Post a comment to an issue (internal helper)
|
||||||
|
# Args: issue_number body_text
|
||||||
|
# Uses a temp file to avoid large inline strings.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
_ilc_post_comment() {
|
||||||
|
local issue="$1" body="$2"
|
||||||
|
|
||||||
|
local tmpfile tmpjson
|
||||||
|
tmpfile=$(mktemp /tmp/ilc-comment-XXXXXX.md)
|
||||||
|
tmpjson="${tmpfile}.json"
|
||||||
|
printf '%s' "$body" > "$tmpfile"
|
||||||
|
jq -Rs '{body:.}' < "$tmpfile" > "$tmpjson"
|
||||||
|
curl -sf -o /dev/null -X POST \
|
||||||
|
-H "Authorization: token ${FORGE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${FORGE_API}/issues/${issue}/comments" \
|
||||||
|
--data-binary @"$tmpjson" 2>/dev/null || true
|
||||||
|
rm -f "$tmpfile" "$tmpjson"
|
||||||
|
}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# issue_block — add "blocked" label, post diagnostic comment, remove in-progress.
|
# issue_block — add "blocked" label, post diagnostic comment, remove in-progress.
|
||||||
# Args: issue_number reason [result_text]
|
# Args: issue_number reason [result_text]
|
||||||
|
|
@ -187,14 +208,9 @@ issue_block() {
|
||||||
fi
|
fi
|
||||||
} > "$tmpfile"
|
} > "$tmpfile"
|
||||||
|
|
||||||
# Post comment
|
# Post comment using shared helper
|
||||||
jq -Rs '{body:.}' < "$tmpfile" > "${tmpfile}.json"
|
_ilc_post_comment "$issue" "$(cat "$tmpfile")"
|
||||||
curl -sf -o /dev/null -X POST \
|
rm -f "$tmpfile"
|
||||||
-H "Authorization: token ${FORGE_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
"${FORGE_API}/issues/${issue}/comments" \
|
|
||||||
--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