chore: GitHub label 자동화#4
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough이슈와 ChangesGitHub 자동 라벨 워크플로우
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/auto-label.yml
Jy000n
left a comment
There was a problem hiding this comment.
라벨 자동화는 처음인데 사용해보면 편할 것 같아서 기대가 되네요-!! 팀원별 라벨까지..!! 센스 쨩👍
| ]; | ||
|
|
||
| for (const rule of titleRules) { | ||
| if (rule.patterns.some(pattern => title.includes(pattern) || body.includes(pattern))) { |
There was a problem hiding this comment.
P4) 현재 title뿐만 아니라 body에서도 패턴 매칭이 되고 있는데, 본문에 기존 fix: 방식과 다르게처럼 작성하면 의도치 않게 fix 라벨이 달릴 수 있을 것 같아요.!! 혹시 body까지 보는 이유가 따로 있으실까요? 물론 실제로 그런 문구를 본문에 쓸 일은 거의 없을 것 같아서 크게 영향은 없을 것 같은데 궁금해서 여쭤봤습니당,,
There was a problem hiding this comment.
의견 감사합니다. 제가 이전에 쓰던 템플릿에는 본문에도 prefix를 적어두어서 or로 처리해두었는데 저희는 제목에만 작성하니 없애는게 좋겠네요! 수정하겠습니다!
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (1)
.github/workflows/auto-label.yml
Jy000n
left a comment
There was a problem hiding this comment.
좋은 것 같습니다!! 정규식 패턴 처리도 인상 깊네요-!!
|
|
||
| const authorLabels = { | ||
| 'Jy000n': '🌸 자윤', | ||
| 'aneykrap': '🌼 예나', |
There was a problem hiding this comment.
제가 아까 이슈 팔때 라벨을 🌵선인장으로 변경햇어요 혹시 괜찮다면 나중에 제가 선인장으로 변경해도 될까여
| throw error; | ||
| } | ||
| }))); | ||
|
|
There was a problem hiding this comment.
+ 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를 변경하면 새 라벨만 추가되고 기존 라벨은 남아 있어서 수동으로 수정해야 하는 것 같아서 의견 남겨봅니당...!
관련 이슈 🛠
작업 내용 요약 ✏️
이슈와 PR 생성/수정 시 제목, 본문, 작성자 정보를 기준으로 라벨을 자동 부여하는 GitHub Actions 워크플로우를 추가했습니다.
주요 변경 사항 🛠️
.github/workflows/auto-label.yml추가feat,fix,hotfix,docs,refactor,chore,test,style,comment,rename,remove키워드에 따라 라벨 적용트러블 슈팅 ⚽️
PR 이벤트에서도 라벨을 추가할 수 있도록
pull_request_target이벤트를 사용하고,issues: write,pull-requests: write권한을 명시했습니다.테스트 결과 📄
로컬에서 워크플로우 YAML 변경 내용을 확인했습니다.
실제 라벨 적용 여부는 GitHub Actions 실행 환경에서 확인이 필요합니다.
스크린샷 📷
해당 없음
리뷰 요구사항 📢
라벨 자동화는 develop 브랜치에 올라간 후부터 작동한다고 하더라고요... 그래서 머지 후에 issue 파서 테스트 해보아야할 것 같습니다.
Summary by CodeRabbit
Summary by CodeRabbit