zentol commented on a change in pull request #14:
URL: https://github.com/apache/flink-jira-bot/pull/14#discussion_r634990129
##########
File path: flink_jira_rule.py
##########
@@ -60,58 +60,15 @@ def has_recently_updated_subtask(self, parent,
updated_within_days):
issues = self.get_issues(find_subtasks_updated_within)
return len(issues) > 0
- def add_label(self, issue, label):
- labels = issue["fields"]["labels"] + [label]
- fields = {"labels": labels}
- key = issue["key"]
+ def add_label_with_comment(self, key, label, comment):
Review comment:
```suggestion
```
##########
File path: stale_assigned_rule.py
##########
@@ -41,5 +41,26 @@ def run(self):
f"AND updated < startOfDay(-{self.stale_days}d)"
)
- def handle_stale_ticket(self, key):
- self.unassign(key)
+ def handle_stale_ticket(self, key, warning_label, done_label, comment):
+ self.unassign(key, warning_label, done_label, comment)
+
+ def unassign(self, key, warning_label, done_label, comment):
+ if not self.is_dry_run:
+ if self.jira_client.get_issue_status(key) == "In Progress":
+ self.jira_client.edit_issue(
+ key,
+ {"assignee": [{"set": {"name":
self.jira_client.username}}]},
+ notify_users=False,
+ )
+ self.jira_client.set_issue_status(key, "Open")
+ self.jira_client.edit_issue(
+ key,
+ {
+ "labels": [{"add": done_label}, {"remove": warning_label}],
+ "comment": [{"add": {"body": comment}}],
+ "assignee": [{"set": {"name": None}}],
+ },
+ notify_users=False,
+ )
Review comment:
Have you checked whether these 2 can be combined as well?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]