Skip to content

[Chore] 이슈 본문에 맞춰 라벨링 자동화#178

Merged
yourjinKR merged 1 commit into
prography:mainfrom
yourjinKR:chore/issue-auto-label
Jul 20, 2026
Merged

[Chore] 이슈 본문에 맞춰 라벨링 자동화#178
yourjinKR merged 1 commit into
prography:mainfrom
yourjinKR:chore/issue-auto-label

Conversation

@yourjinKR

@yourjinKR yourjinKR commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

PR 타입(하나 이상의 PR 타입을 선택해주세요)

  • Feat : 새로운 백엔드 기능 추가
  • Bug : 서버/로직 버그 발견 및 수정
  • Refactor : 백엔드 코드 구조 개선
  • Chore : 의존성/설정/인프라 유지보수
  • API : API 엔드포인트 및 스펙 변경
  • DB : DB 스키마/쿼리/마이그레이션 변경
  • Performance : 성능 개선 및 병목 최적화
  • Test : 백엔드 테스트 코드 추가/수정
  • Docs : 백엔드 문서 수정
  • Security : 보안 취약점 대응 및 강화

변경 사항

  • 이슈 생성, 수정 및 재오픈 시 이슈 폼의 선택값에 따라 라벨을 자동으로 적용하는 GitHub Actions를 추가했습니다.
  • 처리 시기 선택값에 따라 P0~P3 라벨이 적용되도록 구성했습니다.
  • 중요도 선택값에 따라 Critical~Low 라벨이 적용되도록 구성했습니다.
  • 선택값이 변경되면 기존 처리 시기 및 중요도 라벨을 제거하고 새로운 라벨로 교체하도록 구현했습니다.
  • 이슈 템플릿의 작업 종류 라벨을 기존 PR 라벨 명명 규칙과 통일했습니다.
  • label.sh에 처리 시기 및 중요도 라벨 초기화 설정을 추가했습니다.
  • 기존 GitHub 기본 라벨을 삭제하는 로직을 제거했습니다.

테스트 결과

  • 이슈 폼 본문의 LF 및 CRLF 줄바꿈 환경에서 선택값이 정상적으로 추출되는 것을 확인했습니다.
  • 처리 시기와 중요도 변경 시 기존 라벨이 제거되고 새로운 라벨이 추가되는 것을 확인했습니다.
  • JavaScript 문법 검사와 라벨 처리 로직 테스트를 통과했습니다.
  • GitHub Actions 및 이슈 템플릿 YAML 파싱 검사를 통과했습니다.
  • label.sh 셸 문법 검사를 통과했습니다.

Summary by CodeRabbit

  • New Features

    • Added automatic issue labeling when issues are created, reopened, or edited.
    • Labels now update based on selected scheduling, severity, timing, and priority details.
    • Added standardized priority and importance labels, including P0–P3 and Critical–Low.
  • Improvements

    • Updated issue templates to apply consistent labels for bugs, chores, documentation, features, and refactoring.
    • Existing labels are preserved during label setup instead of being removed.

@github-actions github-actions Bot added the 🚚 chore 의존성/설정/인프라 유지보수 (Maintenance) label Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Issue templates now use normalized labels, label.sh provisions schedule and severity labels without deleting existing labels, and a GitHub Actions workflow automatically synchronizes issue labels from issue-form values.

Changes

Issue labeling

Layer / File(s) Summary
Label names and provisioning
.github/ISSUE_TEMPLATE/*, label.sh
Issue templates use normalized label names; label.sh preserves existing labels and upserts P0P3 plus CriticalLow labels.
Issue-form label engine
.github/scripts/issue-auto-label.js
Parses schedule and severity fields, computes managed label additions and removals, and updates labels through the GitHub Issues API.
Issue-event workflow wiring
.github/workflows/issue-auto-label.yml
Runs the local labeling script for opened, edited, and reopened issues with issue write permissions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Issue
  participant GitHubActions
  participant issue-auto-label.js
  participant GitHubIssuesAPI
  Issue->>GitHubActions: opened, edited, or reopened event
  GitHubActions->>issue-auto-label.js: execute with issue context
  issue-auto-label.js->>issue-auto-label.js: parse issue-form values
  issue-auto-label.js->>GitHubIssuesAPI: add or remove managed labels
Loading

Possibly related PRs

Suggested reviewers: developer-choi-jae-young

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 이슈 본문 기반 라벨 자동화라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 필수 템플릿의 PR 타입, 변경 사항, 테스트 결과가 모두 구체적으로 작성되어 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 1

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

19-20: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Set persist-credentials: false in the checkout step.

To follow security best practices and prevent the GitHub token from persisting in the .git/config of the runner environment, set persist-credentials: false since this workflow does not need to push changes back to the repository.

🔒️ Proposed fix
       - name: Checkout labeling script
         uses: actions/checkout@v5
+        with:
+          persist-credentials: false
🤖 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/issue-auto-label.yml around lines 19 - 20, Update the
“Checkout labeling script” actions/checkout step to set persist-credentials to
false, preventing the GitHub token from being stored in the runner’s Git
configuration while preserving the existing checkout behavior.

Source: Linters/SAST tools

label.sh (1)

4-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove commented-out code.

Dead code should be removed to keep the script clean and maintainable. The version control system retains the history if it's ever needed again.

♻️ Proposed fix
-#labels=(bug documentation duplicate enhancement "good first issue" "help wanted" invalid question wontfix)
-#
-#for label in "${labels[@]}"; do
-#  gh label delete "$label" --yes 2>/dev/null
-#done
🤖 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 `@label.sh` around lines 4 - 8, Remove the commented-out labels array and
deletion loop from label.sh, leaving only active script content and preserving
any intended executable behavior.
🤖 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/scripts/issue-auto-label.js:
- Around line 10-19: Update readIssueFormValue so the optional match capture is
also safely chained before calling trim, returning undefined when the heading or
value is absent instead of throwing a TypeError.

---

Nitpick comments:
In @.github/workflows/issue-auto-label.yml:
- Around line 19-20: Update the “Checkout labeling script” actions/checkout step
to set persist-credentials to false, preventing the GitHub token from being
stored in the runner’s Git configuration while preserving the existing checkout
behavior.

In `@label.sh`:
- Around line 4-8: Remove the commented-out labels array and deletion loop from
label.sh, leaving only active script content and preserving any intended
executable behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed3cb4b8-447d-4f65-8c87-5491956d3883

📥 Commits

Reviewing files that changed from the base of the PR and between 1d74fba and 606d2d1.

📒 Files selected for processing (9)
  • .github/ISSUE_TEMPLATE/bug.yml
  • .github/ISSUE_TEMPLATE/chore.yml
  • .github/ISSUE_TEMPLATE/deploy.yml
  • .github/ISSUE_TEMPLATE/docs.yml
  • .github/ISSUE_TEMPLATE/feature.yml
  • .github/ISSUE_TEMPLATE/refactor.yml
  • .github/scripts/issue-auto-label.js
  • .github/workflows/issue-auto-label.yml
  • label.sh

Comment on lines +10 to +19
function readIssueFormValue(body, heading) {
const pattern = new RegExp(
`^###[ \\t]+${escapeRegExp(heading)}[ \\t]*\\r?\\n` +
`(?:[ \\t]*\\r?\\n)*([^\\r\\n]+)`,
'm',
);
const match = body.match(pattern);

return match?.[1].trim();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Prevent TypeError when the issue body does not contain the heading.

If the issue body doesn't match the expected pattern (e.g., if a user deletes the headings or submits a blank issue), match will be null. The expression match?.[1] will evaluate to undefined, and calling .trim() on it will throw a TypeError, causing the GitHub Action to crash.

Use optional chaining before .trim() to safely handle missing matches.

🩹 Proposed fix
 function readIssueFormValue(body, heading) {
   const pattern = new RegExp(
     `^###[ \\t]+${escapeRegExp(heading)}[ \\t]*\\r?\\n` +
       `(?:[ \\t]*\\r?\\n)*([^\\r\\n]+)`,
     'm',
   );
   const match = body.match(pattern);
 
-  return match?.[1].trim();
+  return match?.[1]?.trim();
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function readIssueFormValue(body, heading) {
const pattern = new RegExp(
`^###[ \\t]+${escapeRegExp(heading)}[ \\t]*\\r?\\n` +
`(?:[ \\t]*\\r?\\n)*([^\\r\\n]+)`,
'm',
);
const match = body.match(pattern);
return match?.[1].trim();
}
function readIssueFormValue(body, heading) {
const pattern = new RegExp(
`^###[ \\t]+${escapeRegExp(heading)}[ \\t]*\\r?\\n` +
`(?:[ \\t]*\\r?\\n)*([^\\r\\n]+)`,
'm',
);
const match = body.match(pattern);
return match?.[1]?.trim();
}
🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 10-14: Detects non-literal values in regular expressions
Context: new RegExp(
^###[ \\t]+${escapeRegExp(heading)}[ \\t]*\\r?\\n +
(?:[ \\t]*\\r?\\n)*([^\\r\\n]+),
'm',
)
Note: [CWE-1333] Inefficient Regular Expression Complexity (ReDoS via non-literal RegExp).

(detect-non-literal-regexp)

🤖 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/scripts/issue-auto-label.js around lines 10 - 19, Update
readIssueFormValue so the optional match capture is also safely chained before
calling trim, returning undefined when the heading or value is absent instead of
throwing a TypeError.

@Developer-Choi-Jae-Young Developer-Choi-Jae-Young 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.

고생하셨습니다.

@yourjinKR
yourjinKR merged commit 80aacc9 into prography:main Jul 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚚 chore 의존성/설정/인프라 유지보수 (Maintenance)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants