-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-ticket.py
More file actions
33 lines (29 loc) · 810 Bytes
/
Copy pathcreate-ticket.py
File metadata and controls
33 lines (29 loc) · 810 Bytes
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
import os
from pprint import pprint
from atlassian import Jira
import logging
logging.basicConfig(filename='create-ticket.log',level=logging.DEBUG)
url = os.environ.get('URL')
username = os.environ.get('USERNAME')
password = os.environ.get('PASSWORD')
project = os.environ.get("PROJECT")
issue_type = os.environ.get("ISSUE_TYPE")
summary = os.environ.get("SUMMARY")
description_file = os.environ.get('DESCRIPTION')
jira = Jira(
url=url,
username=username,
password=password
)
with open("{}.md".format (description_file), 'r') as file:
description = file.read()
response = jira.issue_create(fields={
'project': {'key': project},
'issuetype': {
"name": issue_type
},
'summary': summary,
'description': description,
})
issue_id = response['key']
print (issue_id)