Skip to content

[CI] 이슈 작성자 라벨 자동 부착 자동화 - #9

Merged
kimminna merged 5 commits into
developfrom
ci/root/8-issue-author-auto-label
Jun 25, 2026
Merged

[CI] 이슈 작성자 라벨 자동 부착 자동화#9
kimminna merged 5 commits into
developfrom
ci/root/8-issue-author-auto-label

Conversation

@kimminna

@kimminna kimminna commented Jun 23, 2026

Copy link
Copy Markdown
Member

ISSUE 🔗

close #8



What is this PR? 🔍

auto-label.yml 워크플로우에 이슈 작성자별 라벨 자동 부착 기능을 추가하고, 기존 PR 라벨링 job을 통합 및 권한을 정리했습니다. 또한 라벨 중복 처리 및 job 실행 순서 문제를 수정했습니다.

이슈 작성자 라벨링 추가

기존 워크플로우는 pull_request 이벤트만 처리했기 때문에 이슈 생성 시 작성자 라벨이 자동으로 붙지 않았습니다. on: 트리거에 issues: [opened]를 추가하고, 이슈 전용 label-issues job을 새로 만들어 이슈 생성 시에도 동일한 작성자 매핑이 적용되도록 했습니다.

kimminna   → ♦️ 민아
ehye1      → ♥️ 혜원
jjangminii → ♠️ 정민
yumin-kim2 → ♣️ 유민

job 통합

기존 label-by-prefixlabel-by-author가 거의 동일한 조건(!synchronize)으로 별도 job을 차지하면서 GitHub Checks UI에 불필요한 Skipped 항목이 노출됐습니다. 두 job을 label-pr 하나로 통합하고, 작성자 라벨은 내부 조건(opened / reopened)으로 분기 처리했습니다. 결과적으로 4개 → 3개 job으로 줄었습니다.

이전 이후
label-by-files label-by-files
label-by-prefix label-pr (prefix + author 통합)
label-by-author (Skipped 노출) ↑ 내부 조건으로 처리
issue-label-by-author label-issues

최소 권한 분리

워크플로우 레벨에서 pull-requests: writeissues: write를 모든 job에 부여하던 구조를 개선했습니다. 워크플로우 레벨은 contents: read만 유지하고, 각 job에 실제 필요한 권한만 선언했습니다.

  • label-by-files, label-prpull-requests: write
  • label-issuesissues: write

라벨 중복 처리 방지 및 job 순서 보장

label-by-fileslabel-pr이 병렬로 실행되면서 GitHub API 호출이 뒤섞여 "added ♥️ 혜원 🛠️ Setup ⏰ Timo-web and removed 🛠️ Setup ♥️ 혜원" 같은 혼란스러운 활동 로그가 반복 발생했습니다. 두 가지 원인이 있었습니다.

병렬 실행 경합: label-by-files가 라벨을 추가하는 동시에 label-pr이 현재 라벨 목록을 읽어 처리하면서 결과가 뒤섞였습니다. label-prneeds: label-by-files를 추가해 순차 실행으로 변경했습니다.

불필요한 remove → add 사이클: label-pr이 이벤트마다 prefix 라벨을 무조건 제거 후 재추가해, 라벨이 바뀌지 않아도 활동 로그에 노출됐습니다. 현재 붙어있는 라벨과 원하는 라벨이 다를 때만 변경하도록 수정했습니다.

작성자 라벨 중복 추가: reopened 이벤트 시 이미 존재하는 작성자 라벨을 다시 추가하면서 활동 로그에 노출됐습니다. 라벨이 없을 때만 추가하도록 수정했습니다.



To Reviewers

label-pr job 내부에서 prefix 처리와 author 처리를 순서대로 실행하는 구조입니다. needs: label-by-files로 파일 기반 라벨링이 끝난 뒤 현재 라벨 상태를 읽기 때문에 경합 없이 동작합니다. 라벨 변경 전에 현재 상태를 읽어두는 방식(currentLabelNames Set)이라 두 처리가 한 스크립트 안에 있어도 일관성이 보장됩니다.

Screenshot 📷



Test Checklist ✔

  • PR 생성 시 prefix 라벨 자동 부착 확인
  • PR 생성 시 작성자 라벨 자동 부착 확인
  • PR 제목 수정 시 prefix 라벨 교체 확인 (기존 prefix 라벨과 다를 때만 변경)
  • PR 재오픈 시 작성자 라벨 중복 없이 1회만 부착 확인
  • 이슈 생성 시 작성자 라벨 자동 부착 확인
  • Checks UI에서 Skipped job 미노출 확인
  • 활동 로그에 "added X and removed X" 형태 중복 노출 없음 확인

Summary by CodeRabbit

릴리스 노트

  • Chores
    • 자동 라벨링을 이슈 생성(열림)까지 확장하고, 작성자 매핑이 있는 경우에만 라벨을 적용하도록 조정
    • 풀 리퀘스트 라벨링의 실행 조건과 흐름을 정리해 동기화 이벤트에 대한 동작을 명확히 제한
    • 워크플로 권한을 잡 단위로 세분화하고, 파일/프리픽스 기반 라벨 처리 조건을 강화
    • [REFACTOR]로 시작하는 이슈 제목에 적용되는 라벨을 🧹 CHORE에서 ♻ Refactor로 변경

@github-actions
github-actions Bot requested a review from jjangminii June 23, 2026 07:38
@github-actions github-actions Bot added the 😎 DevOps CI/CD, 자동화, 개발 파이프라인 관리 label Jun 23, 2026
@github-actions
github-actions Bot requested a review from yumin-kim2 June 23, 2026 07:38
@github-actions github-actions Bot added the ♦️ 민아 민아상 label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 722f797b-13af-49ff-b1f8-7a1817280145

📥 Commits

Reviewing files that changed from the base of the PR and between 1d28219 and 222fcfa.

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

📝 Walkthrough

Walkthrough

GitHub Actions 자동 라벨링 워크플로우가 pull request와 issue 모두를 처리하도록 확장되었습니다. PR 라벨링 조건과 작성자 처리 흐름이 정리되었고, 이슈 제목 접두사 라벨과 이슈 작성자 라벨 매핑도 조정되었습니다.

Changes

이슈·PR 자동 라벨링 확장

Layer / File(s) Summary
트리거·권한·잡 조건 정리
.github/workflows/auto-label.yml
issues: [opened] 트리거와 issues: write 권한이 추가되고, label-by-filespull_request 이벤트에서만 실행되며, label-prpull_requestsynchronize 제외 조건으로 정리됩니다.
PR 제목·작성자 라벨링
.github/workflows/auto-label.yml
label-pr 스크립트가 pr.titleprNumber를 기준으로 prefix 라벨을 처리하고, edited 이벤트에서는 제목 변경이 있을 때만 prefix 라벨을 갱신합니다. 작성자 라벨은 opened/reopened에서만 authorMap 매핑을 확인해 적용됩니다.
이슈 작성자 라벨링
.github/workflows/auto-label.yml, .github/workflows/auto-issue.yml
label-issues 잡이 추가되어 issue 작성자 로그인으로 authorMap을 조회하고, 매핑이 있으면 issue 번호에 해당 라벨을 추가합니다. [REFACTOR] 접두사에 대한 이슈 라벨은 🧹 CHORE에서 ♻ Refactor로 변경됩니다.

Sequence Diagram(s)

sequenceDiagram
  participant GitHub as GitHub Events
  participant autoLabel as auto-label.yml
  participant labelPR as label-pr
  participant labelIssues as label-issues

  GitHub->>autoLabel: pull_request opened/synchronize/edited
  autoLabel->>labelPR: prefix 및 작성자 라벨 처리
  GitHub->>autoLabel: issues opened
  autoLabel->>labelIssues: issue 작성자 라벨 처리
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 분

Possibly related PRs

  • Team-Timo/Timo-client#4: 같은 auto-label.ymlauto-issue.yml에서 라벨/접두사 처리 흐름을 다룬 이전 PR입니다.

Suggested reviewers

  • ehye1
  • jjangminii
  • yumin-kim2

Poem

🐰 둥실둥실 GitHub 바람 타고
PR엔 라벨, 이슈엔 또 다른 표정
♠️ ♣️ ♥️ ♦️ 이름표가 반짝이면
토끼는 콩닥콩닥 발을 맞춰요
자동 라벨 춤, 오늘도 살랑살랑 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning auto-issue.yml의 [REFACTOR] 라벨을 '🧹 CHORE'에서 '♻ Refactor'로 바꾼 변경은 #8 범위 밖입니다. 이 변경은 별도 PR로 분리하거나, 링크된 이슈에 포함된 요구사항으로 명시해 범위를 맞추세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 이슈 작성자 자동 라벨 부착이라는 핵심 변경을 간결하게 잘 요약합니다.
Linked Issues check ✅ Passed 이슈 opened 트리거, issues: write 권한, PR 전용 조건, 이슈 작성자 라벨 잡 추가가 요구사항을 충족합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@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: 2

🤖 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 9-12: The workflow-level permissions block grants `pull-requests:
write` and `issues: write` to all jobs, which violates the principle of least
privilege. Remove these write permissions from the workflow-level permissions
configuration and instead add job-level `permissions` sections to specify which
specific jobs actually need `pull-requests: write` and `issues: write`
permissions. This ensures only jobs that require these permissions have them,
while keeping the workflow-level permissions restricted to `contents: read`.
- Line 112: Replace the version tag reference in the actions/github-script
action from `@v7` to a pinned commit SHA to reduce supply chain risk. Change
`uses: actions/github-script@v7` to use the full commit SHA `6546db9` which
corresponds to v7.0.0, ensuring the action uses a specific immutable commit
rather than a movable tag.
🪄 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: 1953c644-ed07-49f0-9ac3-74396c5e36ba

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfe50d and ec3c384.

📒 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

@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: 2

🤖 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:
- Line 19: Replace the moveable version tag reference in the actions/labeler
action from v5 to a full-length commit SHA to mitigate supply chain risk.
Instead of using `actions/labeler@v5`, pin it to a specific commit SHA (format:
`actions/labeler@<full-40-character-SHA>`) to ensure that the exact version of
the action is always used regardless of any tag movements.
- Around line 15-21: The `label-by-files` job's permissions block is missing a
required permission for the `actions/labeler@v5` action. In the permissions
section of the job that uses `actions/labeler@v5`, add `contents: read`
alongside the existing `pull-requests: write` permission. The labeler action
requires both read access to repository contents and write access to pull
requests to function correctly.
🪄 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: 33e48196-a2b8-402b-be71-c70ed333294f

📥 Commits

Reviewing files that changed from the base of the PR and between ec3c384 and 59e5707.

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

Comment thread .github/workflows/auto-label.yml
Comment thread .github/workflows/auto-label.yml
@kimminna kimminna added this to the Project Setup milestone Jun 23, 2026

@jjangminii jjangminii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이슈 작성자 라벨 안붙길래 뭐 잘못했나 했는데 아직 머지 안된거였네요 ㅎㅎ
확실히 라벨 자동화하니까 너무 편리해요~ 고생하셨습니당 👍

@kimminna
kimminna requested a review from ehye1 June 24, 2026 09:48

@yumin-kim2 yumin-kim2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이슈에도 라벨 자동으로 붙는 거 편할 것 같아요! 수고하셨습니다 👍👍

@@ -86,17 +116,12 @@ jobs:
'yumin-kim2': '♣️ 유민',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

엇 label-issues authorMap에 저만 있는 것 같아요..! 나머지 분들 매핑이 빠진 것 같은데 확인 부탁드려요 🙏

kimminna added 2 commits June 25, 2026 11:03
- label-pr 잡이 label-by-files 완료 후 실행되도록 needs 의존성을 추가했습니다
- prefix 라벨이 이미 올바르게 설정된 경우 불필요한 remove → add 사이클을 방지했습니다
- 작성자 라벨이 이미 존재하면 재추가하지 않도록 중복 체크를 추가했습니다
- 이슈의 [REFACTOR] prefix 매핑을 🧹 CHORE에서 ♻ Refactor로 수정했습니다

@ehye1 ehye1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

두 워크플로우가 동시에 실행돼서 오류가 발생햇던거였군요!!!!
배워갑니다.. 수고하셨어요!!

@kimminna
kimminna merged commit bdbf5c5 into develop Jun 25, 2026
8 checks passed
@kimminna
kimminna deleted the ci/root/8-issue-author-auto-label branch June 25, 2026 08:17
@kimminna kimminna mentioned this pull request Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♦️ 민아 민아상 😎 DevOps CI/CD, 자동화, 개발 파이프라인 관리

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] 이슈 작성자 라벨 자동 부착 자동화

4 participants