Skip to content

Commit c2eff55

Browse files
committed
Infra: 자동화 워크 플로우 추가
- PR을 열었을 때 자동으로 제목에 (#이슈변호)가 뒤에 생성되도록 추가
1 parent e81c74a commit c2eff55

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
File renamed without changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Auto Format PR Title
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
format-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Update PR title with issue number from branch
12+
uses: actions/github-script@v6
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
script: |
16+
const pr = context.payload.pull_request;
17+
const branch = pr.head.ref;
18+
19+
// 브랜치 명에서 숫자 추출
20+
const issueMatch = branch.match(/(\d+)/);
21+
22+
if (issueMatch) {
23+
const newTitle = `${pr.title} (#${issueMatch[1]})`;
24+
console.log(`✏️ Updating PR title: ${newTitle}`);
25+
await github.rest.pulls.update({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
pull_number: pr.number,
29+
title: newTitle
30+
});
31+
} else {
32+
console.log("⚠️ No issue number found in branch name");
33+
}

0 commit comments

Comments
 (0)