auto: PR for feat/auto-merge-retest #9
@@ -36,11 +36,24 @@ jobs:
|
|||||||
PR_NUMBER=$(cat /tmp/pr_resp.json | sed -n 's/.*"number":\([0-9]*\).*/\1/p' | head -n1)
|
PR_NUMBER=$(cat /tmp/pr_resp.json | sed -n 's/.*"number":\([0-9]*\).*/\1/p' | head -n1)
|
||||||
else
|
else
|
||||||
echo "PR not created (possibly exists). Response:"; cat /tmp/pr_resp.json || true
|
echo "PR not created (possibly exists). Response:"; cat /tmp/pr_resp.json || true
|
||||||
# Find existing open PR for this branch
|
fi
|
||||||
|
|
||||||
|
# Retry to resolve PR number by listing open PRs and matching head/base
|
||||||
|
i=0
|
||||||
|
while [ -z "${PR_NUMBER:-}" ] && [ $i -lt 10 ]; do
|
||||||
|
i=$((i+1))
|
||||||
|
echo "[retry $i] Resolving PR number for $HEAD_BRANCH -> $BASE_BRANCH"
|
||||||
curl -sS -o /tmp/pr_list.json -H "Authorization: token ${CI_TOKEN}" \
|
curl -sS -o /tmp/pr_list.json -H "Authorization: token ${CI_TOKEN}" \
|
||||||
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls?state=open" || true
|
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls?state=open" || true
|
||||||
PR_NUMBER=$(cat /tmp/pr_list.json | awk -v b="$HEAD_BRANCH" 'BEGIN{RS="},"} {if($0~"\"head\":\{[^}]*\"ref\":\""b"\""){match($0,/\"number\":([0-9]+)/,m); if(m[1]!=""){print m[1]; exit}}}')
|
# Extract PR number matching head.ref==HEAD_BRANCH and base.ref==BASE_BRANCH
|
||||||
fi
|
PR_NUMBER=$(awk -v hb="$HEAD_BRANCH" -v bb="$BASE_BRANCH" 'BEGIN{RS="},"; pr=""} {
|
||||||
|
if($0 ~ /\"head\":\{[^}]*\"ref\":\"" hb "\"/ && $0 ~ /\"base\":\{[^}]*\"ref\":\"" bb "\"/){
|
||||||
|
if (match($0, /\"number\":([0-9]+)/, m)) { print m[1]; exit }
|
||||||
|
}
|
||||||
|
}' /tmp/pr_list.json)
|
||||||
|
if [ -z "${PR_NUMBER:-}" ]; then sleep 2; fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ -n "${PR_NUMBER:-}" ]; then
|
if [ -n "${PR_NUMBER:-}" ]; then
|
||||||
echo "Adding 'automerge' label to PR #$PR_NUMBER"
|
echo "Adding 'automerge' label to PR #$PR_NUMBER"
|
||||||
curl -sS -X POST \
|
curl -sS -X POST \
|
||||||
@@ -49,5 +62,5 @@ jobs:
|
|||||||
"${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 '["automerge"]' || true
|
||||||
else
|
else
|
||||||
echo "PR number could not be determined; skipping label add"
|
echo "PR number could not be determined after retries; skipping label add"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -249,3 +249,5 @@
|
|||||||
- [YYYY-MM-DD] 로컬 이미지 업로드 허용: 서버 저장 없이 ZIP에 `assets/`로 패키징(브라우저 JSZip 우선).
|
- [YYYY-MM-DD] 로컬 이미지 업로드 허용: 서버 저장 없이 ZIP에 `assets/`로 패키징(브라우저 JSZip 우선).
|
||||||
|
|
||||||
- [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)
|
||||||
|
|||||||
Reference in New Issue
Block a user