Created
December 13, 2016 13:16
-
-
Save sebkouba/64cc08c5793ace5410d80b5935d1d088 to your computer and use it in GitHub Desktop.
Batch delete Jira worklogs using Python wrapper
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
from jira import JIRA | |
jira = JIRA(server="https://domain.com", basic_auth=('username', 'password')) | |
# first initial search | |
query = "timespent > 0 AND project = PROJKEY and issuetype=defect" | |
relevant_issues = jira.search_issues(query, maxResults=50) | |
# loop hast to be adjusted if the number of results is very large so the search is executed again | |
while relevant_issues: | |
for issue in relevant_issues: | |
for worklog in jira.worklogs(issue): | |
print(issue.fields.summary) | |
print(worklog) | |
worklog.delete(adjustEstimate="leave") | |
# if issues remain they are found here | |
relevant_issues = jira.search_issues(query, maxResults=50) | |
print("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment