From fdd61019ca690d8be3fe407973c2f2ece9ef8e4d Mon Sep 17 00:00:00 2001 From: whqtker Date: Tue, 9 Jun 2026 11:33:39 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20ff-merge=20=EC=95=A1=EC=85=98=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EB=B8=94=20=EA=B8=B0=EB=B0=98=20=ED=8A=B8?= =?UTF-8?q?=EB=A6=AC=EA=B1=B0=EB=A1=9C=20=EA=B5=90=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ff-merge.yml | 36 +++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ff-merge.yml b/.github/workflows/ff-merge.yml index a9b91f85..5ab2cd37 100644 --- a/.github/workflows/ff-merge.yml +++ b/.github/workflows/ff-merge.yml @@ -1,15 +1,15 @@ name: FF-Only Merge to Master on: - pull_request_review: - types: [submitted] + pull_request: + types: [labeled] check_suite: types: [completed] jobs: ff-merge: if: | - github.event_name == 'pull_request_review' || + (github.event_name == 'pull_request' && github.event.label.name == 'ready-to-merge') || (github.event_name == 'check_suite' && github.event.check_suite.conclusion == 'success') runs-on: ubuntu-latest @@ -21,16 +21,12 @@ jobs: script: | let prNumber, headSha; - if (context.eventName === 'pull_request_review') { + if (context.eventName === 'pull_request') { const pr = context.payload.pull_request; if (pr.base.ref !== 'master' || pr.head.ref !== 'develop' || pr.state !== 'open') { core.setOutput('ready', 'false'); return; } - if (context.payload.review.state !== 'approved') { - core.setOutput('ready', 'false'); - return; - } prNumber = pr.number; headSha = pr.head.sha; } else { @@ -56,25 +52,15 @@ jobs: } } - // 승인 상태 확인 - const { data: reviews } = await github.rest.pulls.listReviews({ + // ready-to-merge 레이블 확인 + const { data: pr } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, }); - const latest = {}; - for (const r of reviews) { - if (r.state !== 'COMMENTED') { - latest[r.user.login] = r.state; - } - } - - const values = Object.values(latest); - const approved = values.filter(s => s === 'APPROVED').length >= 1; - const blocked = values.some(s => s === 'CHANGES_REQUESTED'); - - if (!approved || blocked) { + const hasLabel = pr.labels.some(l => l.name === 'ready-to-merge'); + if (!hasLabel) { core.setOutput('ready', 'false'); return; } @@ -120,9 +106,9 @@ jobs: APPROVED_SHA="${{ steps.validate.outputs.head_sha }}" CURRENT_SHA=$(git rev-parse origin/develop) if [ "$APPROVED_SHA" != "$CURRENT_SHA" ]; then - echo "develop이 승인 이후 변경되었습니다." - echo " 승인된 SHA: $APPROVED_SHA" - echo " 현재 SHA: $CURRENT_SHA" + echo "레이블 부착 이후 develop이 변경되었습니다." + echo " 레이블 시점 SHA: $APPROVED_SHA" + echo " 현재 SHA: $CURRENT_SHA" exit 1 fi From 3bf3a6b938e9a16b6714d23142ee0faeb388c931 Mon Sep 17 00:00:00 2001 From: whqtker Date: Tue, 9 Jun 2026 11:38:42 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20context.workflow=20=EB=8C=80?= =?UTF-8?q?=EC=8B=A0=20context.job=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ff-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ff-merge.yml b/.github/workflows/ff-merge.yml index 5ab2cd37..95122dfc 100644 --- a/.github/workflows/ff-merge.yml +++ b/.github/workflows/ff-merge.yml @@ -73,7 +73,7 @@ jobs: per_page: 100, }); - const ciRuns = check_runs.filter(r => r.name !== context.workflow); + const ciRuns = check_runs.filter(r => r.name !== context.job); const allPassed = ciRuns.length > 0 && ciRuns.every(r => r.status === 'completed' && ['success', 'skipped', 'neutral'].includes(r.conclusion) From 8cb70625122ef0a5d962b2b961334ebd246e502f Mon Sep 17 00:00:00 2001 From: whqtker Date: Tue, 9 Jun 2026 11:45:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20write=20=EA=B6=8C=ED=95=9C=EC=9D=B4?= =?UTF-8?q?=20=EC=9E=88=EB=8A=94=20=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20=EC=B6=94=EA=B0=80=20=EA=B2=80=EC=A6=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ff-merge.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ff-merge.yml b/.github/workflows/ff-merge.yml index 95122dfc..7b7555b9 100644 --- a/.github/workflows/ff-merge.yml +++ b/.github/workflows/ff-merge.yml @@ -27,6 +27,19 @@ jobs: core.setOutput('ready', 'false'); return; } + + // 레이블을 부착한 주체의 저장소 권한 확인 + const { data: perm } = await github.rest.repos.getCollaboratorPermissionLevel({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.sender.login, + }); + + if (!['admin', 'write'].includes(perm.permission)) { + core.setOutput('ready', 'false'); + return; + } + prNumber = pr.number; headSha = pr.head.sha; } else {