Skip to content

Commit f1e8295

Browse files
authored
Merge pull request #34 from YAPP-Github/feat/#29
ci: Jira 관련 워크플로우 생성 (#29)
2 parents 32106be + b2a56eb commit f1e8295

File tree

4 files changed

+168
-18
lines changed

4 files changed

+168
-18
lines changed

.github/ISSUE_TEMPLATE/-web1--이슈-생성-템플릿.md

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "YAPP-Web-Team-1-FE 이슈 생성"
2+
description: "YAPP-Web-Team-1-FE Front Repo에 이슈를 생성하며, 생성된 이슈는 Jira와 연동됩니다."
3+
labels: [order]
4+
title: "이슈 이름을 작성해주세요"
5+
body:
6+
- type: input
7+
id: parentKey
8+
attributes:
9+
label: "🏷️ 상위 작업 (Ticket Number)"
10+
description: "상위 작업의 Ticket Number를 기입해주세요"
11+
placeholder: "PRODUCT-00"
12+
validations:
13+
required: true
14+
15+
- type: dropdown
16+
id: branch
17+
attributes:
18+
label: "🧩 브랜치 prefix"
19+
options:
20+
- revert
21+
- refactor
22+
- perf
23+
- feature
24+
- bug
25+
- ci
26+
- style
27+
- docs
28+
- build
29+
- chore
30+
- test
31+
validations:
32+
required: true
33+
34+
- type: textarea
35+
id: details
36+
attributes:
37+
label: "🚀 구현 내용"
38+
description: "이슈에 대해서 자세히 설명해주세요"
39+
value: |
40+
- About Details
41+
validations:
42+
required: true
43+
44+
- type: textarea
45+
id: tasks
46+
attributes:
47+
label: "✅ 할 일"
48+
description: "해당 이슈에 대해 필요한 작업목록을 작성해주세요"
49+
value: |
50+
- [ ] Task1
51+
- [ ] Task2
52+
validations:
53+
required: true
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Close Jira issue
2+
on:
3+
issues:
4+
types:
5+
- closed
6+
7+
jobs:
8+
close-issue:
9+
name: Close Jira issue
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Login to Jira
14+
uses: atlassian/gajira-login@v3
15+
env:
16+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
17+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
19+
20+
- name: Extract Jira issue key from GitHub issue title
21+
id: extract-key
22+
run: |
23+
ISSUE_TITLE="${{ github.event.issue.title }}"
24+
JIRA_KEY=$(echo "$ISSUE_TITLE" | grep -oE '[A-Z]+-[0-9]+')
25+
echo "JIRA_KEY=$JIRA_KEY" >> $GITHUB_ENV
26+
27+
- name: Close Jira issue
28+
if: env.JIRA_KEY != ''
29+
uses: atlassian/gajira-transition@v3
30+
with:
31+
issue: ${{ env.JIRA_KEY }}
32+
transition: 완료
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Create Jira issue
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
jobs:
7+
create-issue:
8+
name: Create Jira issue
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Login
12+
uses: atlassian/gajira-login@v3
13+
env:
14+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
15+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
16+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17+
18+
- name: Checkout main code
19+
uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
23+
- name: Issue Parser
24+
uses: stefanbuck/github-issue-parser@v3
25+
id: issue-parser
26+
with:
27+
template-path: .github/ISSUE_TEMPLATE/issue-form.yml
28+
29+
- name: Log Issue Parser
30+
run: |
31+
echo '${{ steps.issue-parser.outputs.jsonString }}'
32+
33+
- name: Convert markdown to Jira Syntax
34+
uses: peter-evans/jira2md@v1
35+
id: md2jira
36+
with:
37+
input-text: |
38+
### Github Issue Link
39+
- ${{ github.event.issue.html_url }}
40+
41+
${{ github.event.issue.body }}
42+
mode: md2jira
43+
44+
- name: Create Issue
45+
id: create
46+
uses: atlassian/gajira-create@v3
47+
with:
48+
project: PRODUCT
49+
issuetype: 하위 작업
50+
summary: "${{ github.event.issue.title }}"
51+
description: "${{ steps.md2jira.outputs.output-text }}"
52+
fields: |
53+
{
54+
"parent": {
55+
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
56+
}
57+
}
58+
59+
- name: Log created issue
60+
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
61+
62+
- name: Create branch with Ticket number
63+
run: |
64+
ISSUE_NUMBER="${{ steps.create.outputs.issue }}"
65+
ISSUE_BRANCH="${{ steps.issue-parser.outputs.issueparser_branch }}"
66+
BRANCH_NAME="$(echo ${ISSUE_BRANCH} | sed 's/ /-/g')/${ISSUE_NUMBER}"
67+
git checkout -b "${BRANCH_NAME}"
68+
git push origin "${BRANCH_NAME}"
69+
70+
- name: Update issue title
71+
uses: actions-cool/issues-helper@v3
72+
with:
73+
actions: "update-issue"
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
title: "[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}"
76+
77+
- name: Add comment with Jira issue link
78+
uses: actions-cool/issues-helper@v3
79+
with:
80+
actions: "create-comment"
81+
token: ${{ secrets.GITHUB_TOKEN }}
82+
issue-number: ${{ github.event.issue.number }}
83+
body: "Jira Issue Created: [${{ steps.create.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }})"

0 commit comments

Comments
 (0)