Compare commits

..

7 Commits

Author SHA1 Message Date
jaybe 6ff27295e6 chore(ci): prevent duplicate 'automerge' creation — use existing label id only (auto-label/auto-pr)
Auto PR / open-pr (push) Successful in 29s
Auto Label PR / add-automerge-label (pull_request) Successful in 6s
CI / test (pull_request) Successful in 1m10s
2025-11-14 22:33:43 +09:00
jaybe 8d5501d927 Merge pull request 'auto: PR for feat/auto-label-payload-fix' (#15) from feat/auto-label-payload-fix into main 2025-11-14 13:24:01 +00:00
jaybe cd8ae32203 chore(ci): auto-label robust ID resolution (pagination)
Auto PR / open-pr (push) Successful in 32s
Auto Label PR / add-automerge-label (pull_request) Successful in 14s
CI / test (pull_request) Successful in 57s
2025-11-14 22:22:27 +09:00
jaybe 7110db8a4a Merge pull request 'auto: PR for feat/auto-label-payload-fix' (#14) from feat/auto-label-payload-fix into main 2025-11-14 13:17:16 +00:00
jaybe 7b36e14b65 chore(ci): auto-label payload fix 재검증 ping 2025-11-14 22:15:14 +09:00
jaybe 32a760dd9a Merge pull request 'auto: PR for feat/auto-label-payload-fix' (#13) from feat/auto-label-payload-fix into main 2025-11-14 13:14:31 +00:00
jaybe 3d2f1dc8d4 chore(ci): fix auto-label payload for Gitea API (use label id object) 2025-11-14 22:12:55 +09:00
2 changed files with 28 additions and 9 deletions
+11 -2
View File
@@ -20,9 +20,18 @@ jobs:
echo "CI_TOKEN not set; skipping labeling"; exit 0; fi echo "CI_TOKEN not set; skipping labeling"; exit 0; fi
OWNER=$(echo "$REPO" | cut -d'/' -f1) OWNER=$(echo "$REPO" | cut -d'/' -f1)
NAME=$(echo "$REPO" | cut -d'/' -f2) NAME=$(echo "$REPO" | cut -d'/' -f2)
echo "Labeling PR #$PR_NUMBER on $OWNER/$NAME with 'automerge'" echo "Resolving existing label id for 'automerge' in $OWNER/$NAME (no creation)"
curl -sS -o /tmp/labels.json -H "Authorization: token ${CI_TOKEN}" \
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/labels?limit=1000" || true
# Extract all ids whose name == automerge, prefer the smallest id (oldest)
LID=$(tr '\n' ' ' < /tmp/labels.json | \
grep -o '"id":[0-9][0-9]*[^\}]*"name":"automerge"' | \
sed -E 's/.*"id":([0-9]+).*/\1/' | sort -n | head -n1 || true)
if [ -z "${LID:-}" ]; then
echo "No existing 'automerge' label found; skipping labeling"; exit 0; fi
echo "Labeling PR #$PR_NUMBER with id $LID"
curl -sS -X POST \ curl -sS -X POST \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: token ${CI_TOKEN}" \ -H "Authorization: token ${CI_TOKEN}" \
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}/labels" \ "${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}/labels" \
-d '["automerge"]' || true -d '{"labels":['"${LID}"']}' || true
+17 -7
View File
@@ -55,12 +55,22 @@ jobs:
done done
if [ -n "${PR_NUMBER:-}" ]; then if [ -n "${PR_NUMBER:-}" ]; then
echo "Adding 'automerge' label to PR #$PR_NUMBER" echo "Resolving existing label id for 'automerge' (no creation)"
curl -sS -X POST \ curl -sS -o /tmp/labels.json -H "Authorization: token ${CI_TOKEN}" \
-H "Content-Type: application/json" \ "${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/labels?limit=1000" || true
-H "Authorization: token ${CI_TOKEN}" \ LID=$(tr '\n' ' ' < /tmp/labels.json | \
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}/labels" \ grep -o '"id":[0-9][0-9]*[^\}]*"name":"automerge"' | \
-d '["automerge"]' || true sed -E 's/.*"id":([0-9]+).*/\1/' | sort -n | head -n1 || true)
if [ -n "${LID:-}" ]; then
echo "Adding 'automerge' (id=$LID) label to PR #$PR_NUMBER"
curl -sS -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token ${CI_TOKEN}" \
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}/labels" \
-d '{"labels":['"${LID}"']}' || true
else
echo "No existing 'automerge' label found; skipping label add"
fi
else else
echo "PR number could not be determined after retries; skipping label add" echo "PR number could not be determined; skipping label add"
fi fi