Jiseoup/showmycodePublic
EN|KO
  • 코드
  • 커밋
  • 풀 리퀘스트
← 목록으로

Merge pull request #37 from Jiseoup/chore/pr-labeler-and-issue-labels

chore: add PR auto-labeler and update issue template labels

JiseoupJISUB LIM · 2026년 6월 22일d5d9c2e

변경된 파일3개+49 -2

변경된 파일

+49 -2 · 3개

@@ -2,7 +2,7 @@
name: Bug Report
about: Report a bug to help us improve
title: ""
-labels: fix
+labels: bug
---
## Description
@@ -2,7 +2,7 @@
name: Feature Request
about: Suggest a new feature or improvement
title: ""
-labels: feat
+labels: enhancement
---
## Problem
@@ -0,0 +1,47 @@
+name: PR Labeler
+
+on:
+ pull_request:
+ types: [opened, edited]
+
+jobs:
+ label:
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+
+ steps:
+ - name: Apply label based on PR title prefix
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const title = context.payload.pull_request.title;
+ const prefixMap = {
+ 'feat': 'feat',
+ 'fix': 'fix',
+ 'chore': 'chore',
+ 'refactor': 'refactor',
+ 'docs': 'docs',
+ 'i18n': 'i18n',
+ };
+
+ const match = title.match(/^(\w+)(\(.+\))?:/);
+ if (!match) return;
+
+ const label = prefixMap[match[1]];
+ if (!label) return;
+
+ const { data: labels } = await github.rest.issues.listLabelsOnIssue({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ });
+
+ if (labels.some(l => l.name === label)) return;
+
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ labels: [label],
+ });