Jiseoup/showmycodePublic
EN|KO
  • Code
  • Commits
  • Pull Requests
← Back to list
Merged

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

#37
JiseoupJiseoup · Jun 22, 2026chore/pr-labeler-and-issue-labels → main
chore
OverviewCommitsFiles changed
Changed files

+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],
+ });