From 7abd3b56cdb5154594c24ca3b9e7d94070241b83 Mon Sep 17 00:00:00 2001 From: "siraj.yasin" Date: Tue, 23 Feb 2021 14:30:39 +0000 Subject: [PATCH] Disable Issue assignment by age of the issue. * BOT has a logic to pick all old issues > 30 days and try to assign it to other user if it is not closed yet. But it assigns to same user on every run. While this issue is investigated and getting resolved, this feature is temporarily disabled. Change-Id: I50ea2af35320ef1decbf84ae8760d5508e31f793 --- gerrit_to_github_issues/github_issues.py | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gerrit_to_github_issues/github_issues.py b/gerrit_to_github_issues/github_issues.py index fad95fc..f807f90 100644 --- a/gerrit_to_github_issues/github_issues.py +++ b/gerrit_to_github_issues/github_issues.py @@ -100,18 +100,20 @@ def try_assign(issue: github.Issue): issue.create_comment(f'assigned {assignment_request.user.login}') return - if issue_age(issue) > 30: - # If the issue is 1 months old and the original assignees haven't - # closed it yet, let's assume that they've stopped working on it and - # allow the new user to have this issue - old_assignees = issue.assignees - for assignee in old_assignees: - issue.remove_from_assignees(assignee) - issue.add_to_assignees(assignment_request.user) - comment_body = f'unassigned: {", ".join([str(a) for a in old_assignees])}\n' + \ - f'assigned: {assignment_request.user.login}' - issue.create_comment(comment_body) - return + # Disable this logic due to an issue. Will re-visit this logic + # and will be re-enabled after testing + #if issue_age(issue) > 30: + # # If the issue is 1 months old and the original assignees haven't + # # closed it yet, let's assume that they've stopped working on it and + # # allow the new user to have this issue + # old_assignees = issue.assignees + # for assignee in old_assignees: + # issue.remove_from_assignees(assignee) + # issue.add_to_assignees(assignment_request.user) + # comment_body = f'unassigned: {", ".join([str(a) for a in old_assignees])}\n' + \ + # f'assigned: {assignment_request.user.login}' + # issue.create_comment(comment_body) + # return # If we've made it here, a user has requested to be assigned to a non-stale # issue which is already assigned. Just notify the core team and let them