Skip to content

Commit 440b3fb

Browse files
committed
chore: jira 이슈 등록 액션 추가
1 parent 20abb71 commit 440b3fb

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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-praser@v3
25+
id: issue-parser
26+
with:
27+
template-path: .github/ISSUE_TEMPLATE/01-feat-template.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: JT1
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: Checkout main code
63+
uses: actions/checkout@v4
64+
with:
65+
ref: main
66+
67+
- name: Get first label as branch prefix
68+
id: label
69+
run: |
70+
PREFIX=$(echo '${{ toJson(github.event.issue.labels) }}' | jq -r '.[0].name // "feat"')
71+
echo "prefix=$PREFIX" >> $GITHUB_OUTPUT
72+
73+
- name: Create branch with Ticket number
74+
run: |
75+
BRANCH_PREFIX="${{ steps.label.outputs.prefix }}"
76+
ISSUE_NUMBER="${{ steps.create.outputs.issue }}"
77+
BRANCH_NAME="${BRANCH_PREFIX}/${ISSUE_NUMBER}"
78+
git checkout -b "${BRANCH_NAME}"
79+
git push origin "${BRANCH_NAME}"
80+
81+
- name: Update issue title
82+
uses: actions-cool/issues-helper@v3
83+
with:
84+
actions: "update-issue"
85+
token: ${{ secrets.GITHUB_TOKEN }}
86+
title: "[${{ steps.create.outputs.issue }}] ${{ github.event.issue.title }}"

0 commit comments

Comments
 (0)