Skip to content

Commit a321669

Browse files
authored
chore: Update create-jira-issue.yml
1 parent 2614570 commit a321669

1 file changed

Lines changed: 52 additions & 17 deletions

File tree

.github/workflows/create-jira-issue.yml

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,34 @@ jobs:
88
name: Create Jira issue
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: 조건 분기 체크
12-
if: contains(github.event.issue.labels.*.name, '✨ feat')
13-
run: echo "Feature 이슈이므로 Jira 생성 시작합니다."
11+
- name: Determine Issue Type
12+
id: type
13+
run: |
14+
if echo "${{ toJson(github.event.issue.labels) }}" | grep -q '✨ feat'; then
15+
echo "type=feature" >> $GITHUB_OUTPUT
16+
echo "template=feature-task.yml" >> $GITHUB_OUTPUT
17+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '🐞 fix'; then
18+
echo "type=fix" >> $GITHUB_OUTPUT
19+
echo "template=fix-task.yml" >> $GITHUB_OUTPUT
20+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '🔨 refactor'; then
21+
echo "type=refactor" >> $GITHUB_OUTPUT
22+
echo "template=refactor-task.yml" >> $GITHUB_OUTPUT
23+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '📃 docs'; then
24+
echo "type=docs" >> $GITHUB_OUTPUT
25+
echo "template=docs-task.yml" >> $GITHUB_OUTPUT
26+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '⚙️ chore'; then
27+
echo "type=chore" >> $GITHUB_OUTPUT
28+
echo "template=setting-task.yml" >> $GITHUB_OUTPUT
29+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '✅ test'; then
30+
echo "type=test" >> $GITHUB_OUTPUT
31+
echo "template=test-task.yml" >> $GITHUB_OUTPUT
32+
elif echo "${{ toJson(github.event.issue.labels) }}" | grep -q '🎨 style'; then
33+
echo "type=style" >> $GITHUB_OUTPUT
34+
echo "template=style-task.yml" >> $GITHUB_OUTPUT
35+
else
36+
echo "type=other" >> $GITHUB_OUTPUT
37+
echo "template=default.yml" >> $GITHUB_OUTPUT
38+
fi
1439
1540
- name: Jira Login
1641
uses: atlassian/gajira-login@v3
@@ -24,12 +49,12 @@ jobs:
2449
with:
2550
ref: develop
2651

27-
- name: Issue Parser
28-
if: contains(github.event.issue.labels.*.name, '✨ feat')
29-
uses: stefanbuck/github-issue-praser@v3
52+
# 📝 이슈 파싱 (템플릿 경로 자동 선택)
53+
- name: Parse Issue
54+
uses: stefanbuck/github-issue-parser@v3
3055
id: issue-parser
3156
with:
32-
template-path: .github/ISSUE_TEMPLATE/issue-form.yml
57+
template-path: .github/ISSUE_TEMPLATE/${{ steps.type.outputs.template }}
3358

3459
- name: Log Issue Parser
3560
run: |
@@ -56,13 +81,12 @@ jobs:
5681
mode: md2jira
5782

5883
- name: Create Issue
59-
if: contains(github.event.issue.labels.*.name, '✨ feat')
6084
id: create
6185
uses: atlassian/gajira-create@v3
6286
with:
6387
project: BOOK
6488
issuetype: Task
65-
summary: '[✨ feat] ${{ github.event.issue.title }}'
89+
summary: '${{ github.event.issue.title }}'
6690
description: '${{ steps.md2jira.outputs.output-text }}'
6791
fields: |
6892
{
@@ -83,21 +107,23 @@ jobs:
83107
run: |
84108
git fetch origin develop
85109
git checkout develop
86-
87-
- name: Create branch with Ticket number
110+
111+
- name: Generate Branch Name
112+
id: branch
88113
run: |
89-
ISSUE_NUMBER="${{ steps.create.outputs.issue }}"
90-
ISSUE_TITLE="${{ steps.issue-parser.outputs.issueparser_branch}}"
91-
BRANCH_NAME="${ISSUE_NUMBER}-$(echo ${ISSUE_TITLE} | sed 's/ /-/g')"
92-
git checkout -b "${BRANCH_NAME}"
93-
git push origin "${BRANCH_NAME}"
114+
issue_number=${{ github.event.issue.number }}
115+
issue_title="${{ github.event.issue.title }}"
116+
slug=$(echo "$issue_title" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g' | sed 's/[^a-z0-9\-]//g')
117+
ticket_key="${{ steps.create.outputs.issue }}"
118+
branch_name="${ticket_key}-${{ steps.type.outputs.type }}/#${issue_number}"
119+
echo "branch=${branch_name}" >> $GITHUB_OUTPUT
94120
95121
- name: Update issue title
96122
uses: actions-cool/issues-helper@v3
97123
with:
98124
actions: 'update-issue'
99125
token: ${{ secrets.GITHUB_TOKEN }}
100-
title: '[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}'
126+
title: '[${{ steps.create.outputs.issue }} ${{ github.event.issue.title }}'
101127

102128
- name: Add comment with Jira issue link
103129
uses: actions-cool/issues-helper@v3
@@ -106,3 +132,12 @@ jobs:
106132
token: ${{ secrets.GITHUB_TOKEN }}
107133
issue-number: ${{ github.event.issue.number }}
108134
body: 'Jira Issue Created: [${{ steps.create.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }})'
135+
136+
- name: Add comment with Branch Name
137+
uses: actions-cool/issues-helper@v3
138+
with:
139+
actions: 'create-comment'
140+
token: ${{ secrets.GITHUB_TOKEN }}
141+
issue-number: ${{ github.event.issue.number }}
142+
body: '🔀 Branch Created: `${{ steps.branch.outputs.branch }}`'
143+

0 commit comments

Comments
 (0)