Skip to content

Commit fe472e2

Browse files
authored
[Refactor] Jira issue creation workflow steps
1 parent 82ea728 commit fe472e2

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

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

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,29 @@ jobs:
2424
ref: develop
2525

2626
- name: Issue Parser
27-
uses: stefanbuck/github-issue-praser@v3
2827
id: issue-parser
28+
uses: stefanbuck/github-issue-praser@v3
2929
with:
3030
template-path: .github/ISSUE_TEMPLATE/issue-form.yml
3131

32-
- name: Log Issue Parser
33-
run: |
34-
echo '${{ steps.issue-parser.outputs.issueparser_parentKey }}'
35-
echo '${{ steps.issue-parser.outputs.__ticket_number }}'
36-
echo '${{ steps.issue-parser.outputs.jsonString }}'
37-
3832
- name: Map GitHub user to Jira Account ID
3933
id: user-map
4034
if: github.event.issue.assignees[0] != null
4135
run: |
4236
ASSIGNEE_LOGIN="${{ github.event.issue.assignees[0].login }}"
4337
JIRA_ACCOUNT_ID=""
4438
if [[ "$ASSIGNEE_LOGIN" == "sangyup12" ]]; then
45-
JIRA_ACCOUNT_ID="712020:c34fc89a-5eba-4fb8-80d7-952df9c07444?cloudId=10784225-1720-490f-b7c2-871dd37920fc"
39+
JIRA_ACCOUNT_ID="712020:c34fc89a-5eba-4fb8-80d7-952df9c07444"
4640
elif [[ "$ASSIGNEE_LOGIN" == "Yeonnies" ]]; then
47-
JIRA_ACCOUNT_ID="712020:e9701a7b-fc97-4a87-9a60-331acc570dbe?cloudId=10784225-1720-490f-b7c2-871dd37920fc"
41+
JIRA_ACCOUNT_ID="712020:e9701a7b-fc97-4a87-9a60-331acc570dbe"
4842
elif [[ "$ASSIGNEE_LOGIN" == "OneTen19" ]]; then
49-
JIRA_ACCOUNT_ID="712020:aca95733-91c2-4f43-9b27-6bd3e65987e5?cloudId=10784225-1720-490f-b7c2-871dd37920fc"
43+
JIRA_ACCOUNT_ID="712020:aca95733-91c2-4f43-9b27-6bd3e65987e5"
5044
fi
5145
echo "ACCOUNT_ID=$JIRA_ACCOUNT_ID" >> $GITHUB_OUTPUT
5246
5347
- name: Convert markdown to Jira Syntax
54-
uses: peter-evans/jira2md@v1
5548
id: md2jira
49+
uses: peter-evans/jira2md@v1
5650
with:
5751
input-text: |
5852
### Github Issue Link
@@ -63,7 +57,7 @@ jobs:
6357

6458
- name: Create Issue with Assignee
6559
if: steps.user-map.outputs.ACCOUNT_ID != ''
66-
id: create
60+
id: create_with_assignee
6761
uses: atlassian/gajira-create@v3
6862
with:
6963
project: SCRUM
@@ -72,44 +66,45 @@ jobs:
7266
description: '${{ steps.md2jira.outputs.output-text }}'
7367
fields: |
7468
{
75-
"parent": {
76-
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
77-
},
78-
"assignee": {
79-
"accountId": "${{ steps.user-map.outputs.ACCOUNT_ID }}"
80-
}
69+
"parent": { "key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}" },
70+
"assignee": { "accountId": "${{ steps.user-map.outputs.ACCOUNT_ID }}" }
8171
}
8272
8373
- name: Create Issue without Assignee
8474
if: steps.user-map.outputs.ACCOUNT_ID == ''
85-
id: create
75+
id: create_without_assignee
8676
uses: atlassian/gajira-create@v3
8777
with:
8878
project: SCRUM
8979
issuetype: Subtask
9080
summary: '${{ github.event.issue.title }}'
9181
description: '${{ steps.md2jira.outputs.output-text }}'
9282
fields: |
93-
{
94-
"parent": {
95-
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
96-
}
97-
}
83+
{ "parent": { "key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}" } }
9884
85+
- name: Set created issue key
86+
id: set_key
87+
run: |
88+
if [ -n "${{ steps.create_with_assignee.outputs.issue }}" ]; then
89+
echo "ISSUE_KEY=${{ steps.create_with_assignee.outputs.issue }}" >> $GITHUB_OUTPUT
90+
else
91+
echo "ISSUE_KEY=${{ steps.create_without_assignee.outputs.issue }}" >> $GITHUB_OUTPUT
92+
fi
93+
9994
- name: Log created issue
100-
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
95+
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.set_key.outputs.ISSUE_KEY }} was created"
10196

10297
- name: Update issue title
10398
uses: actions-cool/issues-helper@v3
10499
with:
105100
actions: 'update-issue'
106101
token: ${{ secrets.GITHUB_TOKEN }}
107-
title: '[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}'
102+
title: '[${{ steps.set_key.outputs.ISSUE_KEY }}] ${{ github.event.issue.title }}'
108103

109104
- name: Add comment with Jira issue link
110105
uses: actions-cool/issues-helper@v3
111106
with:
112107
actions: 'create-comment'
113108
token: ${{ secrets.GITHUB_TOKEN }}
114109
issue-number: ${{ github.event.issue.number }}
115-
body: 'Jira Issue Created: [${{ steps.create.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }})'
110+
body: 'Jira Issue Created: [${{ steps.set_key.outputs.ISSUE_KEY }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.set_key.outputs.ISSUE_KEY }})' # ⬅️ 참조 변수 변경

0 commit comments

Comments
 (0)