Skip to content

Commit a3e70a2

Browse files
authored
Merge pull request #6 from prgrms-web-devcourse-final-project/chore/EA3-42-github-actions
feat: GitHub 이슈와 Jira Task 연동 자동화 설정 추가
2 parents 330e261 + 3f02bba commit a3e70a2

File tree

8 files changed

+401
-36
lines changed

8 files changed

+401
-36
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
blank_issues_enabled: false
2+
contact_links: []
3+
issue_templates:
4+
- name: '✨ issue-form'
5+
description: 'Repo에 이슈를 생성하며, 생성된 이슈는 Jira와 연동됩니다.'
6+
file: ISSUE_TEMPLATE/issue-form.yml
7+
- name: '🐛 fix-template'
8+
description: '버그 발생 시 사용해주세요'
9+
file: ISSUE_TEMPLATE/fix-form.yml
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: '🐛 fix-template'
2+
description: '버그 발생 시 사용해주세요'
3+
labels: []
4+
body:
5+
- type: dropdown
6+
id: assignee
7+
attributes:
8+
label: '🧑‍💻 담당자'
9+
description: '담당할 팀원의 GitHub 계정을 선택해주세요'
10+
multiple: false
11+
options:
12+
- endorsement0912
13+
- dbrkdgus00
14+
- hyeunS-P
15+
- pia01190
16+
- Tokwasp
17+
validations:
18+
required: true
19+
20+
- type: input
21+
id: parentKey
22+
attributes:
23+
label: '🎟️ 상위 작업 (Epic Number)'
24+
description: '상위 작업을 기입해주세요 (ex. EA3-1)'
25+
placeholder: 'Epic Number'
26+
validations:
27+
required: true
28+
29+
- type: input
30+
id: branch
31+
attributes:
32+
label: '🔠 기능명 (Bug Name)'
33+
description: '기능명을 입력해주세요 (ex. login, dashboard)'
34+
placeholder: '기능명 ex) login'
35+
validations:
36+
required: true
37+
38+
- type: dropdown
39+
id: label-selection
40+
attributes:
41+
label: '🏷️ 라벨 (Label)'
42+
description: '자동으로 라벨이 fix로 지정됩니다.'
43+
multiple: false
44+
options:
45+
- fix
46+
validations:
47+
required: true
48+
49+
- type: input
50+
id: bug-title
51+
attributes:
52+
label: '🐛 버그 설명'
53+
description: '어떤 버그인지 간결하게 요약해주세요 (예: 로그인 버튼이 작동하지 않음)'
54+
validations:
55+
required: true
56+
57+
- type: textarea
58+
id: bug-scenario
59+
attributes:
60+
label: '🚨 버그 발생 상황'
61+
description: '어떤 상황에서 발생했는지 설명해주세요 (Given-When-Then 형식)'
62+
placeholder: |
63+
예시:
64+
- Given: 사용자가 로그인 페이지에 접근했을 때
65+
- When: 이메일과 비밀번호를 입력하고 로그인 버튼을 클릭했을 때
66+
- Then: "로그인 실패" 메시지가 나타나야 함
67+
validations:
68+
required: true
69+
70+
- type: textarea
71+
id: expected-behavior
72+
attributes:
73+
label: '💡 예상 결과'
74+
description: '예상했던 정상적인 결과가 어떤 것이었는지 설명해주세요'
75+
validations:
76+
required: true
77+
78+
- type: textarea
79+
id: actual-behavior
80+
attributes:
81+
label: '🚩 실제 동작'
82+
description: '현재 어떻게 동작하는지 설명해주세요'
83+
validations:
84+
required: true
85+
86+
- type: textarea
87+
id: possible-solution
88+
attributes:
89+
label: '🛠️ 가능한 해결 방법'
90+
description: '문제를 해결하기 위한 아이디어가 있다면 간단히 작성해주세요'
91+
validations:
92+
required: false
93+
94+
- type: textarea
95+
id: additional-info
96+
attributes:
97+
label: '📎 추가 정보'
98+
description: '문제와 관련된 스크린샷이나 에러 로그 또는 기타 참고 자료를 첨부해주세요'
99+
validations:
100+
required: false
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: '✨ issue-form'
2+
description: 'Repo에 이슈를 생성하며, 생성된 이슈는 Jira와 연동됩니다.'
3+
labels: []
4+
body:
5+
- type: dropdown
6+
id: assignee
7+
attributes:
8+
label: '🧑‍💻 담당자'
9+
description: '담당할 팀원의 GitHub 계정을 선택해주세요'
10+
multiple: false
11+
options:
12+
- endorsement0912
13+
- dbrkdgus00
14+
- hyeunS-P
15+
- pia01190
16+
- Tokwasp
17+
validations:
18+
required: true
19+
20+
- type: input
21+
id: parentKey
22+
attributes:
23+
label: '🎟️ 상위 작업 (Epic Number)'
24+
description: '상위 작업을 기입해주세요(ex. EA3-1)'
25+
placeholder: 'Epic Number'
26+
validations:
27+
required: true
28+
29+
- type: input
30+
id: branch
31+
attributes:
32+
label: '🌿 기능명 (Feature Name)'
33+
description: '기능명을 입력해주세요 (ex. login, dashboard)'
34+
placeholder: '기능명 ex) login'
35+
validations:
36+
required: true
37+
38+
- type: dropdown
39+
id: label-selection
40+
attributes:
41+
label: '🏷️ 라벨 (Label)'
42+
description: '이슈의 성격에 맞는 라벨을 선택해주세요'
43+
multiple: false
44+
options:
45+
- feat
46+
- fix
47+
- docs
48+
- style
49+
- refactor
50+
- test
51+
- chore
52+
validations:
53+
required: true
54+
55+
- type: input
56+
id: description
57+
attributes:
58+
label: '📌 이슈 설명 (Description)'
59+
description: '이슈에 대해서 간략히 설명해주세요'
60+
validations:
61+
required: true
62+
63+
- type: textarea
64+
id: tasks
65+
attributes:
66+
label: '📋 작업 목록 (Tasks)'
67+
description: '해당 이슈에 대해 필요한 작업목록을 작성해주세요'
68+
value: |
69+
- [ ] Task1
70+
- [ ] Task2
71+
validations:
72+
required: true

.github/ISSUE_TEMPLATE/✨-feature-template.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/🐛-fix-template.md

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Close Jira issue
2+
3+
on:
4+
issues:
5+
types: [closed]
6+
7+
jobs:
8+
close-issue:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Login to Jira
13+
uses: atlassian/gajira-login@v3
14+
env:
15+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
17+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
18+
19+
- name: Extract Jira issue key from GitHub issue title
20+
id: extract-key
21+
run: |
22+
ISSUE_TITLE="${{ github.event.issue.title }}"
23+
echo "📌 ISSUE_TITLE=$ISSUE_TITLE"
24+
JIRA_KEY=$(echo "$ISSUE_TITLE" | grep -oE '[A-Z0-9]+-[0-9]+')
25+
26+
if [ -z "$JIRA_KEY" ]; then
27+
echo "❌ JIRA 키 추출 실패"
28+
echo "skip=true" >> $GITHUB_ENV
29+
else
30+
echo "✅ JIRA 키: $JIRA_KEY"
31+
echo "JIRA_KEY=$JIRA_KEY" >> $GITHUB_ENV
32+
echo "skip=false" >> $GITHUB_ENV
33+
fi
34+
35+
- name: Get transition ID for Done
36+
if: env.skip == 'false'
37+
id: get-transition
38+
run: |
39+
response=$(curl -s -u "${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}" \
40+
-H "Accept: application/json" \
41+
"${{ secrets.JIRA_BASE_URL }}/rest/api/3/issue/${JIRA_KEY}/transitions")
42+
43+
echo "📦 Response: $response"
44+
45+
TRANSITION_ID=$(echo "$response" | jq -r '.transitions[] | select(.name | test("완료|Done|업무 완료")) | .id')
46+
47+
if [ -z "$TRANSITION_ID" ]; then
48+
echo "❌ 전이 ID 찾기 실패"
49+
echo "skip=true" >> $GITHUB_ENV
50+
else
51+
echo "✅ 전이 ID: $TRANSITION_ID"
52+
echo "TRANSITION_ID=$TRANSITION_ID" >> $GITHUB_ENV
53+
echo "skip=false" >> $GITHUB_ENV
54+
fi
55+
56+
- name: Close Jira issue with curl
57+
if: env.skip == 'false'
58+
run: |
59+
curl -X POST \
60+
-u "${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}" \
61+
-H "Accept: application/json" -H "Content-Type: application/json" \
62+
--data "{ \"transition\": { \"id\": \"${{ env.TRANSITION_ID }}\" } }" \
63+
"${{ secrets.JIRA_BASE_URL }}/rest/api/3/issue/${{ env.JIRA_KEY }}/transitions"

0 commit comments

Comments
 (0)