auto: PR for feat/ci-automerge-guard #10

Merged
jaybe merged 4 commits from feat/ci-automerge-guard into main 2025-11-14 13:04:41 +00:00
3 changed files with 39 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
name: Auto Label PR
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
add-automerge-label:
runs-on: [macos, host]
steps:
- name: Add 'automerge' label to PR
env:
CI_TOKEN: ${{ secrets.CI_TOKEN }}
GITEA_BASE_URL: https://gitea.jaybe.dev
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
if [ -z "${CI_TOKEN:-}" ]; then
echo "CI_TOKEN not set; skipping labeling"; exit 0; fi
OWNER=$(echo "$REPO" | cut -d'/' -f1)
NAME=$(echo "$REPO" | cut -d'/' -f2)
echo "Labeling PR #$PR_NUMBER on $OWNER/$NAME with 'automerge'"
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 '["automerge"]' || true
+7
View File
@@ -56,6 +56,13 @@ jobs:
echo "CI_TOKEN not set; skipping auto-merge"; exit 0; fi echo "CI_TOKEN not set; skipping auto-merge"; 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 "Checking labels for PR #$PR_NUMBER on $OWNER/$NAME"
LABELS_JSON=$(curl -sS -X GET \
-H "Authorization: token ${CI_TOKEN}" \
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}")
if ! echo "$LABELS_JSON" | grep -qi '"name":"automerge"'; then
echo "Label 'automerge' not present; skipping merge"; exit 0; fi
echo "Label 'automerge' present; proceeding to merge"
echo "Merging PR #$PR_NUMBER for $OWNER/$NAME" echo "Merging PR #$PR_NUMBER for $OWNER/$NAME"
RESP=$(curl -sS -X POST \ RESP=$(curl -sS -X POST \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
+4
View File
@@ -251,3 +251,7 @@
- [ci] automerge 재검증용 ping (2025-11-14 21:36:38) - [ci] automerge 재검증용 ping (2025-11-14 21:36:38)
- [ci] auto-pr 라벨 자동부여 재검증 ping (2025-11-14 21:45:14) - [ci] auto-pr 라벨 자동부여 재검증 ping (2025-11-14 21:45:14)
- [ci] auto-label 재트리거 ping (2025-11-14 21:56:22)
- [ci] automerge 라벨 수동부여 후 재트리거 ping (2025-11-14 22:01:41)