chore(ci): auto-label payload fix 재검증 ping
This commit is contained in:
@@ -55,12 +55,29 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${PR_NUMBER:-}" ]; then
|
if [ -n "${PR_NUMBER:-}" ]; then
|
||||||
echo "Adding 'automerge' label to PR #$PR_NUMBER"
|
echo "Resolving label id for 'automerge' in $OWNER/$NAME"
|
||||||
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"
|
||||||
-H "Authorization: token ${CI_TOKEN}" \
|
LID=$(awk 'BEGIN{RS=","} /"name":"automerge"/ {if (match($0,/"id":([0-9]+)/,m)) {print m[1]; exit}}' /tmp/labels.json || true)
|
||||||
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}/labels" \
|
if [ -z "${LID:-}" ]; then
|
||||||
-d '["automerge"]' || true
|
echo "Label 'automerge' not found. Creating..."
|
||||||
|
curl -sS -o /tmp/create_label.json -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: token ${CI_TOKEN}" \
|
||||||
|
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/labels" \
|
||||||
|
-d '{"name":"automerge","color":"#0ea5e9"}'
|
||||||
|
LID=$(sed -n 's/.*"id":\([0-9]*\).*/\1/p' /tmp/create_label.json | head -n1 || true)
|
||||||
|
fi
|
||||||
|
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 "Failed to resolve label id; 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
|
||||||
|
|||||||
Reference in New Issue
Block a user