Created
February 6, 2020 16:23
-
-
Save silverjam/3cd0c0832a69fcd5e24095c2e0921026 to your computer and use it in GitHub Desktop.
JIRA scripting with Python
This file contains hidden or 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
from jira import JIRA | |
server = "https://swift-nav.atlassian.net" | |
api_key = open('jira_api_key.txt').read() | |
# print(api_key) | |
basic_auth = ('[email protected]', api_key) | |
# Query string for the cloned issues: | |
query_str = 'project = INFRA AND issuekey >= INFRA-77 AND issuekey <= INFRA-83 AND creator = currentUser()' | |
# The key of the cloned epic | |
epic_id = 'INFRA-76' | |
jira = JIRA(server, basic_auth=basic_auth) | |
issues = jira.search_issues(query_str) | |
issue = issues[0] | |
# Dump an example issue | |
print(issue) | |
epic_issue = jira.issue(epic_id) | |
template_issue = jira.issue('INFRA-64') | |
# Print the parent link of a template issue | |
print(template_issue.fields.parent) | |
# Setup links for all the issues in the cloned epic | |
for issue in issues: | |
issue.update(fields={"parent": {"key": epic_issue.key, "id": epic_issue.id}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment