-
-
Save awsvpc/7d81d46be5cf63e6c781afc2f49ab4fb to your computer and use it in GitHub Desktop.
jira ticket create
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat scripts/script_jira.py | |
-------------------------------- | |
import os | |
from jira import JIRA | |
def create_ticket(): | |
try: | |
jira_connection = JIRA(basic_auth=(os.environ['JIRA_EMAIL'], os.environ['JIRA_TOKEN']), server=os.environ['JIRA_SERVER_URL']) | |
issue_dict = { | |
'project': {'key': os.environ['JIRA_ORG_ID']}, | |
'summary': os.environ['JIRA_SUMMARY'], | |
'description': os.environ['JIRA_DESCRIPTION'], | |
'issuetype': {'name': 'Task'} | |
} | |
new_issue = jira_connection.create_issue(fields=issue_dict) | |
print(f'{new_issue.key}') | |
return (f'{new_issue.key}') | |
except Exception as e: | |
print(f'Error while creating Jira Ticket: {e}') | |
return '' | |
if __name__ == '__main__': | |
create_ticket() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment