Skip to content

chore: QE testing

chore: QE testing #329

Workflow file for this run

name: PR Title Labeler
on:
pull_request:
types:
- opened
- edited
- reopened
jobs:
label-pr:
runs-on: ubuntu-latest
# 기본 GITHUB_TOKEN 대신 PAT을 쓰기 때문에 permissions 블록은 생략 가능
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Label PR based on title
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT_TOKEN }}
script: |
const title = context.payload.pull_request.title || "";
const labelMap = [
{ pattern: /^feat:/i, label: '✨ feat' },
{ pattern: /^fix:/i, label: '🐞 fix' },
{ pattern: /^refactor:/i, label: '🔨 refactor' },
{ pattern: /^docs:/i, label: '📃 docs' },
{ pattern: /^chore:/i, label: '⚙️ chore' },
{ pattern: /^test:/i, label: '✅ test' },
{ pattern: /^style:/i, label: '🎨 style' }
];
const labelsToAdd = labelMap
.filter(entry => entry.pattern.test(title))
.map(entry => entry.label);
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labelsToAdd
});
core.info(`Added labels: ${labelsToAdd.join(', ')}`);
} else {
core.info('No matching labels found for PR title.');
}