Skip to content

chore: GitHub label 자동화#4

Merged
laura-jung merged 3 commits into
developfrom
chore/#3-autoLabel
Jun 28, 2026
Merged

chore: GitHub label 자동화#4
laura-jung merged 3 commits into
developfrom
chore/#3-autoLabel

Conversation

@laura-jung

@laura-jung laura-jung commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

관련 이슈 🛠

작업 내용 요약 ✏️

이슈와 PR 생성/수정 시 제목, 본문, 작성자 정보를 기준으로 라벨을 자동 부여하는 GitHub Actions 워크플로우를 추가했습니다.

주요 변경 사항 🛠️

  • [자동 라벨링 워크플로우]: .github/workflows/auto-label.yml 추가
  • [타입 라벨 자동 부여]: feat, fix, hotfix, docs, refactor, chore, test, style, comment, rename, remove 키워드에 따라 라벨 적용
  • [작성자 라벨 자동 부여]: 등록된 GitHub 계정별 담당자 라벨 자동 적용
  • [PR/Issue 이벤트 지원]: 이슈 생성/수정 및 PR 생성/수정/재오픈/동기화 시 라벨링 실행

트러블 슈팅 ⚽️

PR 이벤트에서도 라벨을 추가할 수 있도록 pull_request_target 이벤트를 사용하고, issues: write, pull-requests: write 권한을 명시했습니다.

테스트 결과 📄

로컬에서 워크플로우 YAML 변경 내용을 확인했습니다.
실제 라벨 적용 여부는 GitHub Actions 실행 환경에서 확인이 필요합니다.

스크린샷 📷

해당 없음

리뷰 요구사항 📢

라벨 자동화는 develop 브랜치에 올라간 후부터 작동한다고 하더라고요... 그래서 머지 후에 issue 파서 테스트 해보아야할 것 같습니다.

Summary by CodeRabbit

Summary by CodeRabbit

  • 새로운 기능
    • 이슈와 Pull Request 이벤트에서 제목/본문 패턴을 감지해 라벨을 자동으로 적용합니다.
    • 작성자 정보에 따라 사전에 지정된 작성자 라벨도 함께 자동으로 추가됩니다.
    • 기존에 자동으로 관리되던 라벨은 정리한 뒤, 감지된 경우에만 새 라벨을 부여해 수동 작업을 줄입니다.

@laura-jung laura-jung self-assigned this Jun 27, 2026
@laura-jung laura-jung linked an issue Jun 27, 2026 that may be closed by this pull request
1 task
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6788c6c8-23a1-4d14-8ad7-4659f7babb02

📥 Commits

Reviewing files that changed from the base of the PR and between a7a11ba and 9a39c8f.

📒 Files selected for processing (1)
  • .github/workflows/auto-label.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/auto-label.yml

📝 Walkthrough

Walkthrough

이슈와 pull_request_target 이벤트에서 제목, 본문, 작성자 정보를 기준으로 라벨을 계산하고, 기존 관리 라벨을 정리한 뒤 GitHub API로 다시 부여하는 워크플로우가 추가되었습니다.

Changes

GitHub 자동 라벨 워크플로우

Layer / File(s) Summary
워크플로우 트리거와 권한
.github/workflows/auto-label.yml
issuespull_request_target 이벤트를 등록하고, issues: write 권한과 actions/github-script 실행 단계를 정의한다.
라벨 계산과 갱신
.github/workflows/auto-label.yml
제목·본문 정규식 규칙과 작성자 매핑으로 라벨을 수집하고, 관리 대상 라벨을 제거한 뒤 새 라벨을 추가한다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 깡총깡총 라벨 숲을 지나
제목과 본문을 냠냠 읽고
작성자 발자국도 톡톡 모아
반짝이는 라벨을 콕 붙였네
이슈와 PR이 환하게 웃어요 ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 GitHub 라벨 자동화라는 주요 변경을 간결하게 설명합니다.
Linked Issues check ✅ Passed 이슈/PR 이벤트에서 제목과 작성자 기준으로 라벨을 자동 부착해 #3의 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 워크플로우 추가만 있으며, 요구사항과 무관한 별도 변경은 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@laura-jung laura-jung requested review from Jy000n and aneykrap June 27, 2026 07:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/auto-label.yml:
- Around line 31-42: The title matching in the auto-label rules is using
substring checks, so “hotfix:” also satisfies the “fix:” rule and adds both
labels. Update the matching logic in the titleRules handling of the label
patterns (including the entries for “🚨 hotfix” and “🛠️ fix”) to use
boundary-aware matching such as a regex or equivalent exact-token check, so each
title only matches its intended label.
- Around line 9-11: The auto-label workflow is granting more GitHub permissions
than it uses. In the workflow permissions block for the auto-label job, remove
the unnecessary pull-requests: write scope and keep only issues: write, since
the logic only calls github.rest.issues.addLabels; verify the change in the
workflow definition so the permissions are minimized without affecting labeling.
- Line 17: Pin the actions/github-script step in the auto-label workflow to a
full commit SHA instead of the mutable v7 tag. Update the uses entry in the
workflow to reference the specific immutable SHA for actions/github-script, so
the job remains reproducible and safer in a write-enabled GitHub Actions
context.
- Around line 94-100: The auto-label workflow currently only adds newly computed
labels in the label update path, so stale managed labels remain after edits.
Update the logic in the label handling block that calls
github.rest.issues.addLabels to first remove any previously managed labels from
the issue, then re-add the labels calculated from the current title/body state.
Make sure the cleanup/reapply flow uses the existing label set variable and the
issue item context so edited issues stay in sync.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 32e9db2b-b8f0-44e4-9974-47df8a64e159

📥 Commits

Reviewing files that changed from the base of the PR and between ceee4c6 and 38f0dfb.

📒 Files selected for processing (1)
  • .github/workflows/auto-label.yml

Comment thread .github/workflows/auto-label.yml Outdated
Comment thread .github/workflows/auto-label.yml Outdated
Comment thread .github/workflows/auto-label.yml Outdated
Comment thread .github/workflows/auto-label.yml
Jy000n
Jy000n previously approved these changes Jun 27, 2026

@Jy000n Jy000n left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

라벨 자동화는 처음인데 사용해보면 편할 것 같아서 기대가 되네요-!! 팀원별 라벨까지..!! 센스 쨩👍

Comment thread .github/workflows/auto-label.yml Outdated
];

for (const rule of titleRules) {
if (rule.patterns.some(pattern => title.includes(pattern) || body.includes(pattern))) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4) 현재 title뿐만 아니라 body에서도 패턴 매칭이 되고 있는데, 본문에 기존 fix: 방식과 다르게처럼 작성하면 의도치 않게 fix 라벨이 달릴 수 있을 것 같아요.!! 혹시 body까지 보는 이유가 따로 있으실까요? 물론 실제로 그런 문구를 본문에 쓸 일은 거의 없을 것 같아서 크게 영향은 없을 것 같은데 궁금해서 여쭤봤습니당,,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의견 감사합니다. 제가 이전에 쓰던 템플릿에는 본문에도 prefix를 적어두어서 or로 처리해두었는데 저희는 제목에만 작성하니 없애는게 좋겠네요! 수정하겠습니다!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/auto-label.yml (1)

98-110: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

새로 부여할 라벨까지 제거 후 재추가하고 있습니다.

labelsToRemove가 현재 라벨 중 관리 대상 전부를 제거하므로, 이번에 다시 부여될 라벨(labels에 포함된 것)도 일단 제거되었다가 addLabels로 재추가됩니다. 결과적으로 불필요한 API 호출과 labeled/unlabeled 이벤트 노이즈가 발생합니다. 실제로 바뀌어야 하는 라벨(새 집합에 없는 것)만 제거하도록 필터링하는 편이 깔끔합니다.

제안 변경
-            const labelsToRemove = currentLabels.filter(label => managedLabels.has(label));
+            const labelsToRemove = currentLabels.filter(
+              label => managedLabels.has(label) && !labels.has(label)
+            );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/auto-label.yml around lines 98 - 110, The label removal
logic in the auto-label workflow is removing every managed label from
currentLabels, including labels that will be re-added immediately, causing
redundant remove/add calls and extra event noise. Update the labelsToRemove
filtering in the auto-label flow so that only labels present in currentLabels
but not included in the newly requested labels set are passed to
github.rest.issues.removeLabel, keeping the existing addLabels path unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/auto-label.yml:
- Around line 98-110: The label removal logic in the auto-label workflow is
removing every managed label from currentLabels, including labels that will be
re-added immediately, causing redundant remove/add calls and extra event noise.
Update the labelsToRemove filtering in the auto-label flow so that only labels
present in currentLabels but not included in the newly requested labels set are
passed to github.rest.issues.removeLabel, keeping the existing addLabels path
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c1e9267-be21-4d94-b0ff-be6b81ec073d

📥 Commits

Reviewing files that changed from the base of the PR and between 38f0dfb and a7a11ba.

📒 Files selected for processing (1)
  • .github/workflows/auto-label.yml

@laura-jung laura-jung requested a review from Jy000n June 27, 2026 11:55

@Jy000n Jy000n left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 것 같습니다!! 정규식 패턴 처리도 인상 깊네요-!!

@aneykrap aneykrap left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자동라벨링이라니 완전 굿굿이에용


const authorLabels = {
'Jy000n': '🌸 자윤',
'aneykrap': '🌼 예나',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 아까 이슈 팔때 라벨을 🌵선인장으로 변경햇어요 혹시 괜찮다면 나중에 제가 선인장으로 변경해도 될까여

throw error;
}
})));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+            const managedLabels = new Set([
+              ...titleRules.map(rule => rule.label),
+              ...Object.values(authorLabels)
+            ]);
+
+            const currentLabels = (item.labels || []).map(label => label.name);
+            const labelsToRemove = currentLabels.filter(
+              name => managedLabels.has(name) && !labels.has(name)
+            );
+
+            for (const name of labelsToRemove) {
+              await github.rest.issues.removeLabel({
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                issue_number: item.number,
+                name
+              });
+            }
+

p4) 아래 CodeRabbit이 추천해준 코드로 이왕 라벨링 자동화를 구현한 김에 수정하는 기능도 추가해보면 어떨까용? 지금 로직상 나중에 제목의 prefix를 변경하면 새 라벨만 추가되고 기존 라벨은 남아 있어서 수동으로 수정해야 하는 것 같아서 의견 남겨봅니당...!

@laura-jung laura-jung merged commit 84f4918 into develop Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore] GitHub 라벨 자동화 추가

3 participants