Skip to content

Commit a03f7f1

Browse files
authored
[refactor] Jira 이슈 등록 오류 수정
1 parent 72ebc38 commit a03f7f1

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,33 @@ jobs:
3232
echo '${{ steps.issue-parser.outputs.__ticket_number }}'
3333
echo '${{ steps.issue-parser.outputs.jsonString }}'
3434
35+
- name: Derive parentKey
36+
id: derive-parent
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
const body = process.env.BODY || '';
41+
let parent = '';
42+
try {
43+
const parsed = JSON.parse(process.env.JSON || '{}');
44+
parent = (parsed.parentKey || '').trim();
45+
} catch (e) {}
46+
if (!parent) {
47+
const m = body.match(/DASOMFE-\d+/i);
48+
if (m) parent = m[0].toUpperCase();
49+
}
50+
core.setOutput('parent', parent);
51+
env:
52+
BODY: ${{ github.event.issue.body }}
53+
JSON: ${{ steps.issue-parser.outputs.jsonString }}
54+
55+
- name: Validate parentKey
56+
run: |
57+
if [ -z "${{ steps.derive-parent.outputs.parent }}" ]; then
58+
echo "parentKey not found. Fill the form field or include like DASOMFE-2 in the body."
59+
exit 1
60+
fi
61+
3562
- name: Convert markdown to Jira Syntax
3663
uses: peter-evans/jira2md@v1
3764
id: md2jira
@@ -54,12 +81,12 @@ jobs:
5481
fields: |
5582
{
5683
"parent": {
57-
"key": "${{ fromJson(steps.issue-parser.outputs.jsonString).parentKey }}"
84+
"key": "${{ steps.derive-parent.outputs.parent }}"
5885
}
5986
}
6087
6188
- name: Log created issue
62-
run: echo "Jira Issue parent=${{ fromJson(steps.issue-parser.outputs.jsonString).parentKey }} created=${{ steps.create.outputs.issue }}"
89+
run: echo "Jira Issue parent=${{ steps.derive-parent.outputs.parent }} created=${{ steps.create.outputs.issue }}"
6390

6491
- name: Update issue title
6592
uses: actions-cool/issues-helper@v3

0 commit comments

Comments
 (0)