Skip to content

Commit e707dc6

Browse files
committed
jira manipulations
1 parent 305f89f commit e707dc6

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

jira/jira-comments-with-my-name.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from jira import JIRA
2+
import os
3+
4+
def remove_before_minus(s):
5+
return "jira-"+s.split('-')[1]
6+
7+
def add_prefix_to_each_line(s: str):
8+
prefix = " "
9+
return prefix + prefix.join(s.splitlines(True))
10+
11+
# curl -H "Authorization: Bearer ${JIRA_TOKEN}" -X GET ${JIRA_URL}/rest/api/2/myself | jq .
12+
jira = JIRA(server=os.getenv('JIRA_URL'),
13+
token_auth=os.getenv('JIRA_TOKEN'))
14+
15+
# ticket = jira.issue('IOO-6728')
16+
for ticket in jira.search_issues('project = IVSOO AND status not in (Closed) AND text ~ "user-33" order by updated DESC'):
17+
print("##############################")
18+
print(remove_before_minus(ticket.key), ticket.fields.summary)
19+
print("##############################")
20+
comments = ticket.fields.comment.comments
21+
sorted(comments, key=lambda x: x.updated, reverse=True)
22+
for each_comment in comments:
23+
if each_comment.body.find("user-33") != -1:
24+
print(f"{each_comment.updated} - {each_comment.author.displayName} \n--- \n {add_prefix_to_each_line(each_comment.body)}\n--------------")

jira/jira-open-issues.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from jira import JIRA
2+
import os
3+
4+
def remove_before_minus(s):
5+
return "jira-"+s.split('-')[1]
6+
7+
# curl -H "Authorization: Bearer ${JIRA_TOKEN}" -X GET ${JIRA_URL}/rest/api/2/myself | jq .
8+
jira = JIRA(server=os.getenv('JIRA_URL'),
9+
token_auth=os.getenv('JIRA_TOKEN'))
10+
11+
# ticket = jira.issue('IOO-6028')
12+
for ticket in jira.search_issues('assignee = currentUser() AND resolution = Unresolved'):
13+
print(f"{remove_before_minus(ticket.key):12} {ticket.fields.summary:<50}")

0 commit comments

Comments
 (0)