From ec3c3847b587e05d8ea9083dc240824469d18148 Mon Sep 17 00:00:00 2001 From: kimminna Date: Tue, 23 Jun 2026 16:36:13 +0900 Subject: [PATCH 1/5] =?UTF-8?q?ci(root):=20=EC=9D=B4=EC=8A=88=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=EC=9E=90=20=EB=9D=BC=EB=B2=A8=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=EB=B6=80=EC=B0=A9=20=EC=B6=94=EA=B0=80=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-label.yml | 37 ++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index b4075691..1d3cbbe0 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -3,13 +3,17 @@ name: Auto Label on: pull_request: types: [opened, synchronize, edited, reopened] + issues: + types: [opened] permissions: contents: read pull-requests: write + issues: write jobs: label-by-files: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 @@ -18,7 +22,7 @@ jobs: sync-labels: false label-by-prefix: - if: github.event.action != 'synchronize' + if: github.event_name == 'pull_request' && github.event.action != 'synchronize' runs-on: ubuntu-latest steps: - uses: actions/github-script@v7 @@ -73,7 +77,7 @@ jobs: }); label-by-author: - if: github.event.action == 'opened' || github.event.action == 'reopened' + if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') runs-on: ubuntu-latest steps: - uses: actions/github-script@v7 @@ -100,3 +104,32 @@ jobs: issue_number: context.payload.pull_request.number, labels: [label], }); + + issue-label-by-author: + if: github.event_name == 'issues' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const authorMap = { + 'kimminna': '♦️ 민아', + 'ehye1': '♥️ 혜원', + 'jjangminii': '♠️ 정민', + 'yumin-kim2': '♣️ 유민', + }; + + const author = context.payload.issue.user.login; + const label = authorMap[author]; + + if (!label) { + console.log(`"${author}"에 대한 라벨 매핑이 없습니다.`); + return; + } + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.issue.number, + labels: [label], + }); From 59e5707118f2dedb5a24f8518f93d68d6e99a519 Mon Sep 17 00:00:00 2001 From: kimminna Date: Tue, 23 Jun 2026 16:49:48 +0900 Subject: [PATCH 2/5] =?UTF-8?q?ci(root):=20label-by-prefix=C2=B7author?= =?UTF-8?q?=EB=A5=BC=20label-pr=EB=A1=9C=20=ED=86=B5=ED=95=A9,=20job=20?= =?UTF-8?q?=EC=B5=9C=EC=86=8C=20=EA=B6=8C=ED=95=9C=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-label.yml | 119 ++++++++++++++----------------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index 1d3cbbe0..ce996819 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -8,12 +8,12 @@ on: permissions: contents: read - pull-requests: write - issues: write jobs: label-by-files: if: github.event_name == 'pull_request' + permissions: + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 @@ -21,14 +21,19 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: false - label-by-prefix: + label-pr: if: github.event_name == 'pull_request' && github.event.action != 'synchronize' + permissions: + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/github-script@v7 with: script: | - const title = context.payload.pull_request.title; + const pr = context.payload.pull_request; + const action = context.payload.action; + const prNumber = pr.number; + const prefixMap = { '[FEAT]': '✨ Feature', '[FIX]': '🐛 Bug', @@ -43,46 +48,6 @@ jobs: '[PERF]': '✨ Feature', '[API]': '🌟 API', }; - - // edited 이벤트는 본문 수정만으로도 트리거되므로 제목 변경 여부를 확인 - if (context.payload.action === 'edited' && !context.payload.changes?.title) return; - - const allPrefixLabels = [...new Set(Object.values(prefixMap))]; - const match = Object.entries(prefixMap).find(([prefix]) => title.startsWith(prefix)); - - const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - }); - - for (const label of currentLabels) { - if (allPrefixLabels.includes(label.name)) { - await github.rest.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - name: label.name, - }); - } - } - - if (!match) return; - - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: [match[1]], - }); - - label-by-author: - if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v7 - with: - script: | const authorMap = { 'kimminna': '♦️ 민아', 'ehye1': '♥️ 혜원', @@ -90,23 +55,54 @@ jobs: 'yumin-kim2': '♣️ 유민', }; - const author = context.payload.pull_request.user.login; - const label = authorMap[author]; - - if (!label) { - console.log(`"${author}"에 대한 라벨 매핑이 없습니다.`); - return; + // --- prefix 라벨 --- + // edited 이벤트는 본문 수정만으로도 트리거되므로 제목 변경 여부를 확인 + if (action !== 'edited' || context.payload.changes?.title) { + const allPrefixLabels = [...new Set(Object.values(prefixMap))]; + const match = Object.entries(prefixMap).find(([prefix]) => pr.title.startsWith(prefix)); + + const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + for (const label of currentLabels) { + if (allPrefixLabels.includes(label.name)) { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + name: label.name, + }); + } + } + if (match) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + labels: [match[1]], + }); + } } - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: [label], - }); + // --- 작성자 라벨 (opened / reopened 시에만) --- + if (action === 'opened' || action === 'reopened') { + const label = authorMap[pr.user.login]; + if (label) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + labels: [label], + }); + } + } - issue-label-by-author: + label-issues: if: github.event_name == 'issues' + permissions: + issues: write runs-on: ubuntu-latest steps: - uses: actions/github-script@v7 @@ -119,13 +115,8 @@ jobs: 'yumin-kim2': '♣️ 유민', }; - const author = context.payload.issue.user.login; - const label = authorMap[author]; - - if (!label) { - console.log(`"${author}"에 대한 라벨 매핑이 없습니다.`); - return; - } + const label = authorMap[context.payload.issue.user.login]; + if (!label) return; await github.rest.issues.addLabels({ owner: context.repo.owner, From 78565e9f63fe4eb927a2a57af2cfb43b4c89e378 Mon Sep 17 00:00:00 2001 From: kimminna Date: Tue, 23 Jun 2026 17:01:17 +0900 Subject: [PATCH 3/5] =?UTF-8?q?ci(root):=20label-by-files=20job=EC=97=90?= =?UTF-8?q?=20contents:=20read=20=EA=B6=8C=ED=95=9C=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-label.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index ce996819..b89e64fb 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -13,6 +13,7 @@ jobs: label-by-files: if: github.event_name == 'pull_request' permissions: + contents: read pull-requests: write runs-on: ubuntu-latest steps: From 1d28219ff2c906e9883510f3957b432f41bc3de1 Mon Sep 17 00:00:00 2001 From: kimminna Date: Thu, 25 Jun 2026 11:03:02 +0900 Subject: [PATCH 4/5] =?UTF-8?q?ci(root):=20label-pr=20=EC=9E=A1=20?= =?UTF-8?q?=EB=9D=BC=EB=B2=A8=20=EC=A4=91=EB=B3=B5=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=A9=EC=A7=80=20=EB=B0=8F=20=EC=88=9C=EC=B0=A8=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=20=EC=A0=81=EC=9A=A9=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - label-pr 잡이 label-by-files 완료 후 실행되도록 needs 의존성을 추가했습니다 - prefix 라벨이 이미 올바르게 설정된 경우 불필요한 remove → add 사이클을 방지했습니다 - 작성자 라벨이 이미 존재하면 재추가하지 않도록 중복 체크를 추가했습니다 --- .github/workflows/auto-label.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index b89e64fb..c0dddd89 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -24,6 +24,7 @@ jobs: label-pr: if: github.event_name == 'pull_request' && github.event.action != 'synchronize' + needs: label-by-files permissions: pull-requests: write runs-on: ubuntu-latest @@ -56,19 +57,22 @@ jobs: 'yumin-kim2': '♣️ 유민', }; + const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + const currentLabelNames = new Set(currentLabels.map(l => l.name)); + // --- prefix 라벨 --- // edited 이벤트는 본문 수정만으로도 트리거되므로 제목 변경 여부를 확인 if (action !== 'edited' || context.payload.changes?.title) { const allPrefixLabels = [...new Set(Object.values(prefixMap))]; const match = Object.entries(prefixMap).find(([prefix]) => pr.title.startsWith(prefix)); + const desiredLabel = match ? match[1] : null; - const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - }); for (const label of currentLabels) { - if (allPrefixLabels.includes(label.name)) { + if (allPrefixLabels.includes(label.name) && label.name !== desiredLabel) { await github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, @@ -77,20 +81,20 @@ jobs: }); } } - if (match) { + if (desiredLabel && !currentLabelNames.has(desiredLabel)) { await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, - labels: [match[1]], + labels: [desiredLabel], }); } } - // --- 작성자 라벨 (opened / reopened 시에만) --- + // --- 작성자 라벨 (opened / reopened 시에만, 이미 있으면 생략) --- if (action === 'opened' || action === 'reopened') { const label = authorMap[pr.user.login]; - if (label) { + if (label && !currentLabelNames.has(label)) { await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, From 222fcfa7411078559a185d92d158da0412700364 Mon Sep 17 00:00:00 2001 From: kimminna Date: Thu, 25 Jun 2026 11:10:31 +0900 Subject: [PATCH 5/5] =?UTF-8?q?ci(root):=20=EC=9D=B4=EC=8A=88=20[REFACTOR]?= =?UTF-8?q?=20=EB=9D=BC=EB=B2=A8=20=EB=A7=A4=ED=95=91=EC=9D=84=20PR?= =?UTF-8?q?=EA=B3=BC=20=ED=86=B5=EC=9D=BC=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 이슈의 [REFACTOR] prefix 매핑을 🧹 CHORE에서 ♻ Refactor로 수정했습니다 --- .github/workflows/auto-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-issue.yml b/.github/workflows/auto-issue.yml index 9ad14dea..4b7b6d25 100644 --- a/.github/workflows/auto-issue.yml +++ b/.github/workflows/auto-issue.yml @@ -23,7 +23,7 @@ jobs: '[DOCS]': '📝 Docs', '[CI]': '😎 DevOps', '[TEST]': '🌊 TEST', - '[REFACTOR]': '🧹 CHORE', + '[REFACTOR]': '♻ Refactor', '[UI]': '⌚ Timo-Design-system', '[STYLE]': '⌚ Timo-Design-system', '[PERF]': '✨ Feature',