-
Notifications
You must be signed in to change notification settings - Fork 192
121 lines (112 loc) · 3.57 KB
/
create_jira_ticket.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
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Create ticket in Jira
on:
issues:
types: [labeled]
jobs:
Jira:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Store Github Issue url as environment variable
run: |
echo "URL=${{ github.event.issue.url }}" >> $GITHUB_ENV
- name: Get Issue Body and store as environment variable
id: get_issue
run: |
issue_body=$(node ./action.js --url=${{ env.URL }})
echo "BODY=$issue_body" >> $GITHUB_ENV
- name: Create Bug in Jira
if: ${{github.event.label.name == 'bug'}}
env:
JIRA_PROJECT_ID: ${{ secrets.JIRA_PROJECT_ID }}
JIRA_ISSUE_ID: ${{ secrets.JIRA_ISSUE_ID }}
JIRA_REPORTER_ID: ${{ secrets.JIRA_REPORTER_ID }}
run: >
curl
-u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}
-X POST ${{ secrets.JIRA_BASE_URL }}/rest/api/3/issue/
-H 'Content-Type: application/json'
-d '{
"fields": {
"project":
{
"id": "${{env.JIRA_PROJECT_ID}}"
},
"summary": "${{ github.event.issue.title }}",
"issuetype": {
"id": "${{env.JIRA_ISSUE_ID}}"
},
"reporter": {
"id": "${{env.JIRA_REPORTER_ID}}"
},
"labels": [
"github_issues"
],
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": ${{env.BODY}}
}
]
}
]
}
}
}'
- name: Create Enhancement in Jira
if: ${{github.event.label.name == 'enhancement'}}
env:
JIRA_PROJECT_ID: ${{ secrets.JIRA_PROJECT_ID }}
JIRA_REPORTER_ID: ${{ secrets.JIRA_REPORTER_ID }}
JIRA_ENHANCEMENT_ID: ${{ secrets.JIRA_ENHANCEMENT_ID }}
run: >
curl
-u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}
-X POST ${{ secrets.JIRA_BASE_URL }}/rest/api/3/issue/
-H 'Content-Type: application/json'
-d '{
"fields": {
"project":
{
"id": "${{env.JIRA_PROJECT_ID}}"
},
"summary": "${{ github.event.issue.title }}",
"issuetype": {
"id": "${{env.JIRA_ENHANCEMENT_ID}}"
},
"reporter": {
"id": "${{env.JIRA_REPORTER_ID}}"
},
"labels": [
"github_issues"
],
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": ${{env.BODY}}
}
]
}
]
}
}
}'