From 7dbd6c23521eadadd33ca6a1540f35a13e508e84 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Apr 2026 10:05:04 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20fix:=20duplicated=20label=20ID=20lookup?= =?UTF-8?q?=20=E2=80=94=20ensure=5Fblocked=5Flabel=5Fid=20vs=20=5Filc=5Fen?= =?UTF-8?q?sure=5Flabel=5Fid=20(#282)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove ensure_blocked_label_id() from ci-helpers.sh; _ilc_ensure_label_id() in issue-lifecycle.sh is the canonical, general implementation. Update the stale comment that referenced the removed function. Co-Authored-By: Claude Sonnet 4.6 --- lib/ci-helpers.sh | 21 --------------------- lib/issue-lifecycle.sh | 1 - 2 files changed, 22 deletions(-) diff --git a/lib/ci-helpers.sh b/lib/ci-helpers.sh index 42f306e..11c668e 100644 --- a/lib/ci-helpers.sh +++ b/lib/ci-helpers.sh @@ -7,27 +7,6 @@ set -euo pipefail # ci_commit_status() / ci_pipeline_number() require: woodpecker_api(), forge_api() (from env.sh) # classify_pipeline_failure() requires: woodpecker_api() (defined in env.sh) -# ensure_blocked_label_id — look up (or create) the "blocked" label, print its ID. -# Caches the result in _BLOCKED_LABEL_ID to avoid repeated API calls. -# Requires: FORGE_TOKEN, FORGE_API (from env.sh), forge_api() -ensure_blocked_label_id() { - if [ -n "${_BLOCKED_LABEL_ID:-}" ]; then - printf '%s' "$_BLOCKED_LABEL_ID" - return 0 - fi - _BLOCKED_LABEL_ID=$(forge_api GET "/labels" 2>/dev/null \ - | jq -r '.[] | select(.name == "blocked") | .id' 2>/dev/null || true) - if [ -z "$_BLOCKED_LABEL_ID" ]; then - _BLOCKED_LABEL_ID=$(curl -sf -X POST \ - -H "Authorization: token ${FORGE_TOKEN}" \ - -H "Content-Type: application/json" \ - "${FORGE_API}/labels" \ - -d '{"name":"blocked","color":"#e11d48"}' 2>/dev/null \ - | jq -r '.id // empty' 2>/dev/null || true) - fi - printf '%s' "$_BLOCKED_LABEL_ID" -} - # ensure_priority_label — look up (or create) the "priority" label, print its ID. # Caches the result in _PRIORITY_LABEL_ID to avoid repeated API calls. # Requires: FORGE_TOKEN, FORGE_API (from env.sh), forge_api() diff --git a/lib/issue-lifecycle.sh b/lib/issue-lifecycle.sh index 6b14090..3792d3f 100644 --- a/lib/issue-lifecycle.sh +++ b/lib/issue-lifecycle.sh @@ -43,7 +43,6 @@ _ilc_log() { # --------------------------------------------------------------------------- # Label ID caching — lookup once per name, cache in globals. -# Pattern follows ci-helpers.sh (ensure_blocked_label_id). # --------------------------------------------------------------------------- declare -A _ILC_LABEL_IDS _ILC_LABEL_IDS["backlog"]=""