From 54ce91e09eab158fae17a36c909727d532ce6e48 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 25 Mar 2026 15:35:31 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20fix:=20create=5Flabels=20creates=20dupli?= =?UTF-8?q?cate=20labels=20on=20re-run=20=E2=80=94=20no=20idempotency=20ch?= =?UTF-8?q?eck=20(#683)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/disinto | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/disinto b/bin/disinto index e6e1f97..5a68547 100755 --- a/bin/disinto +++ b/bin/disinto @@ -865,8 +865,20 @@ create_labels() { ) echo "Creating labels on ${repo}..." + + # Fetch existing labels so we can skip duplicates + local existing + existing=$(curl -sf \ + -H "Authorization: token ${FORGE_TOKEN}" \ + "${api}/labels?limit=50" 2>/dev/null \ + | grep -o '"name":"[^"]*"' | cut -d'"' -f4) || existing="" + local name color for name in backlog in-progress blocked tech-debt underspecified vision action; do + if echo "$existing" | grep -qx "$name"; then + echo " . ${name} (already exists)" + continue + fi color="${labels[$name]}" if curl -sf -X POST \ -H "Authorization: token ${FORGE_TOKEN}" \ @@ -875,7 +887,7 @@ create_labels() { -d "{\"name\":\"${name}\",\"color\":\"${color}\"}" >/dev/null 2>&1; then echo " + ${name}" else - echo " . ${name} (already exists)" + echo " ! ${name} (failed to create)" fi done }