-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (93 loc) · 3.57 KB
/
create_jira_issue.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Create Jira issue
on:
issues:
types:
- opened
jobs:
create-issue:
name: Create Jira issue
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
- name: Checkout main code
uses: actions/checkout@v4
with:
ref: main
- name: Issue Parser
uses: stefanbuck/github-issue-praser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/feature.yml
- name: Log Issue Parser
run: |
echo '${{ steps.issue-parser.outputs.jsonString }}'
echo "Branch Name : ${{ steps.issue-parser.outputs.issueparser_branch }}"
echo "Start date : ${{ steps.issue-parser.outputs.issueparser_start_date }}"
echo "Due date : ${{ steps.issue-parser.outputs.issueparser_due_date }}"
- name: Convert markdown to Jira Syntax
uses: peter-evans/jira2md@v1
id: md2jira
with:
input-text: |
### Github Issue Link
- ${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
mode: md2jira
- name: Check JIRA_USER_EMAIL
run: |
if [ -z "${{ secrets.JIRA_USER_EMAIL }}" ]; then
echo "JIRA_USER_EMAIL is not set or empty"
else
echo "JIRA_USER_EMAIL is set"
fi
- name: Check JIRA_API_TOKEN
run: |
if [ -z "${{ secrets.JIRA_API_TOKEN }}" ]; then
echo "JIRA_API_TOKEN is not set or empty"
else
echo "JIRA_API_TOKEN is set"
fi
- name: Check JIRA_BASE_URL
run: |
if [ -z "${{ secrets.JIRA_BASE_URL }}" ]; then
echo "JIRA_BASE_URL is not set or empty"
else
echo "JIRA_BASE_URL is set"
fi
- name: List Jira Fields
run: |
curl -u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }} \
-X GET \
-H "Content-Type: application/json" \
"${{ secrets.JIRA_BASE_URL }}/rest/api/2/field"
- name: Create Issue
id: create
uses: atlassian/gajira-create@v3
with:
project: TINU
issuetype: CLIENT
summary: "${{ github.event.issue.title }}"
description: "${{ steps.md2jira.outputs.output-text }}"
fields: '{"parent": { "key": "TINU-49" }, "customfield_10015": "${{ steps.issue-parser.outputs.issueparser_start_date }}", "duedate": "${{ steps.issue-parser.outputs.issueparser_due_date }}"}'
- name: Log created issue
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
- name: Checkout develop code
uses: actions/checkout@v4
with:
ref: main
- name: Create branch with Ticket number
run: |
BRANCH_NAME="${{ steps.create.outputs.issue }}/${{ steps.issue-parser.outputs.issueparser_branch }}"
git checkout -b $BRANCH_NAME
git push origin $BRANCH_NAME
- name: Update issue title
uses: actions-cool/issues-helper@v3
with:
actions: "update-issue"
token: ${{ secrets.GITHUB_TOKEN }}
title: "${{ steps.create.outputs.issue }} ${{ github.event.issue.title }}"