Skip to content

Commit 919130e

Browse files
committed
🔧 [init] : zira-issue 연동
1 parent f0a4631 commit 919130e

File tree

3 files changed

+235
-0
lines changed

3 files changed

+235
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Close Jira Issue
2+
3+
on:
4+
issues:
5+
types:
6+
- closed
7+
8+
jobs:
9+
close-jira-issue:
10+
runs-on: ubuntu-latest
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+
JIRA_KEY=$(echo $ISSUE_TITLE | grep -oP '^CLAP-\d+')
24+
if [ -n "$JIRA_KEY" ]; then
25+
echo "jira_key=$JIRA_KEY" >> $GITHUB_OUTPUT
26+
else
27+
echo "No Jira key found in the issue title"
28+
exit 0
29+
fi
30+
31+
- name: Transition Jira Issue
32+
if: steps.extract-key.outputs.jira_key
33+
uses: atlassian/gajira-transition@v3
34+
with:
35+
issue: ${{ steps.extract-key.outputs.jira_key }}
36+
transition: '완료'
37+
38+
- name: Log Jira issue update
39+
if: steps.extract-key.outputs.jira_key
40+
run: echo "Jira Issue ${{ steps.extract-key.outputs.jira_key }} has been transitioned to Done"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Create Jira Bug 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: Check if issue uses Bug template
12+
id: check_template
13+
run: |
14+
BODY="${{ github.event.issue.body }}"
15+
if [[ $BODY == *"Bug 상위 작업 Ticket Number"* ]]; then
16+
echo "is_bug_template=true" >> $GITHUB_OUTPUT
17+
else
18+
echo "is_bug_template=false" >> $GITHUB_OUTPUT
19+
fi
20+
21+
- name: Exit if not bug template
22+
if: steps.check_template.outputs.is_bug_template != 'true'
23+
run: exit 0
24+
25+
- name: Login
26+
uses: atlassian/gajira-login@v3
27+
env:
28+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
29+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
30+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
31+
32+
- name: Checkout main code
33+
uses: actions/checkout@v4
34+
with:
35+
ref: main
36+
37+
- name: Issue Parser
38+
uses: stefanbuck/github-issue-praser@v3
39+
id: issue-parser
40+
with:
41+
template-path: |
42+
.github/ISSUE_TEMPLATE/bug_issue_form.yml
43+
44+
- name: Log Issue Parser
45+
run: |
46+
echo '${{ steps.issue-parser.outputs.jsonString }}'
47+
48+
- name: Convert markdown to Jira Syntax
49+
uses: peter-evans/jira2md@v1
50+
id: md2jira
51+
with:
52+
input-text: |
53+
### Github Issue Link
54+
- ${{ github.event.issue.html_url }}
55+
56+
${{ github.event.issue.body }}
57+
mode: md2jira
58+
59+
- name: Create Issue
60+
id: create
61+
uses: atlassian/gajira-create@v3
62+
with:
63+
project: CLAP
64+
issuetype: 버그
65+
summary: "[BE] ${{ github.event.issue.title }}"
66+
description: "${{ steps.md2jira.outputs.output-text }}"
67+
fields: |
68+
{
69+
"parent": {
70+
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
71+
}
72+
}
73+
74+
- name: Log created issue
75+
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
76+
77+
- name: Checkout develop code
78+
uses: actions/checkout@v4
79+
with:
80+
ref: develop
81+
token: ${{ secrets.PAT_TOKEN }}
82+
83+
- name: Create branch with Ticket number
84+
run: |
85+
git config user.name github-actions
86+
git config user.email [email protected]
87+
git checkout -b ${{ steps.create.outputs.issue }}
88+
git push origin ${{ steps.create.outputs.issue }}
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
91+
92+
- name: Update issue title
93+
uses: actions-cool/issues-helper@v3
94+
with:
95+
actions: "update-issue"
96+
token: ${{ secrets.PAT_TOKEN }}
97+
title: "${{ steps.create.outputs.issue }} ${{ github.event.issue.title }}"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Create Feature Jira issue
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
7+
jobs:
8+
create-issue:
9+
name: Create Jira issue
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check if issue uses feature template
13+
id: check_template
14+
run: |
15+
BODY="${{ github.event.issue.body }}"
16+
if [[ $BODY == *"Feature 상위 작업 Ticket Number"* ]]; then
17+
echo "is_feature_template=true" >> $GITHUB_OUTPUT
18+
else
19+
echo "is_feature_template=false" >> $GITHUB_OUTPUT
20+
fi
21+
22+
- name: Exit if not feature template
23+
if: steps.check_template.outputs.is_feature_template != 'true'
24+
run: exit 0
25+
26+
- name: Login
27+
uses: atlassian/gajira-login@v3
28+
env:
29+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
30+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
31+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
32+
33+
- name: Checkout main code
34+
uses: actions/checkout@v4
35+
with:
36+
ref: main
37+
38+
- name: Issue Parser
39+
uses: stefanbuck/github-issue-praser@v3
40+
id: issue-parser
41+
with:
42+
template-path: |
43+
.github/ISSUE_TEMPLATE/feature_issue_form.yml
44+
45+
- name: Log Issue Parser
46+
run: |
47+
echo '${{ steps.issue-parser.outputs.jsonString }}'
48+
49+
- name: Convert markdown to Jira Syntax
50+
uses: peter-evans/jira2md@v1
51+
id: md2jira
52+
with:
53+
input-text: |
54+
### Github Issue Link
55+
- ${{ github.event.issue.html_url }}
56+
57+
${{ github.event.issue.body }}
58+
mode: md2jira
59+
60+
- name: Create Issue
61+
id: create
62+
uses: atlassian/gajira-create@v3
63+
with:
64+
project: CLAP
65+
issuetype: 작업
66+
summary: '[BE] ${{ github.event.issue.title }}'
67+
description: '${{ steps.md2jira.outputs.output-text }}'
68+
fields: |
69+
{
70+
"parent": {
71+
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
72+
}
73+
}
74+
75+
- name: Log created issue
76+
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
77+
78+
- name: Checkout develop code
79+
uses: actions/checkout@v4
80+
with:
81+
ref: develop
82+
token: ${{ secrets.PAT_TOKEN }}
83+
84+
- name: Create branch with Ticket number
85+
run: |
86+
git config user.name github-actions
87+
git config user.email [email protected]
88+
git checkout -b ${{ steps.create.outputs.issue }}
89+
git push origin ${{ steps.create.outputs.issue }}
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
92+
93+
- name: Update issue title
94+
uses: actions-cool/issues-helper@v3
95+
with:
96+
actions: 'update-issue'
97+
token: ${{ secrets.PAT_TOKEN }}
98+
title: '${{ steps.create.outputs.issue }} ${{ github.event.issue.title }}'

0 commit comments

Comments
 (0)