зеркало из
1
0
Форкнуть 0

fix assignee for release-helper (#37407)

This commit is contained in:
Yuchao Yan 2024-09-14 17:00:20 +08:00 коммит произвёл GitHub
Родитель 4396007bbe
Коммит 86d97f651c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 8 добавлений и 15 удалений

Просмотреть файл

@ -30,7 +30,6 @@ _HINTS = ["FirstGA", "FirstBeta", "HoldOn", "OnTime", "ForCLI", TYPESPEC_LABEL]
class IssueProcess:
"""
# won't be changed anymore after __init__
request_repo_dict = {} # request repo instance generated by different token
owner = '' # issue owner
assignee_candidates = {} # assignee candidates who will be assigned to handle issue
language_owner = {} # language owner who may handle issue
@ -48,10 +47,9 @@ class IssueProcess:
spec_repo = None # local swagger repo path
"""
def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Repository],
def __init__(self, issue_package: IssuePackage, request_repo: Repository,
assignee_candidates: Set[str], language_owner: Set[str]):
self.issue_package = issue_package
self.request_repo_dict = request_repo_dict
self.assignee = issue_package.issue.assignee.login if issue_package.issue.assignee else ''
self.owner = issue_package.issue.user.login
self.created_time = issue_package.issue.created_at
@ -70,6 +68,7 @@ class IssueProcess:
self.spec_repo = Path(os.getenv('SPEC_REPO'))
self.typespec_json = Path(os.getenv('TYPESPEC_JSON'))
self.language_name = "common"
self.request_repo = request_repo
@property
def for_typespec(self) -> bool:
@ -257,11 +256,8 @@ class IssueProcess:
def log(self, message: str) -> None:
_LOG.info(f'issue {self.issue_package.issue.number}: {message}')
def request_repo(self) -> Repository:
return self.request_repo_dict[self.assignee]
def update_issue_instance(self) -> None:
self.issue_package.issue = self.request_repo().get_issue(self.issue_package.issue.number)
self.issue_package.issue = self.request_repo.get_issue(self.issue_package.issue.number)
def auto_assign_policy(self) -> str:
assignees = list(self.assignee_candidates)
@ -379,7 +375,7 @@ class IssueProcess:
class Common:
""" The class defines some function for all languages to reference
issues_package = None # issues that need to handle
request_repo_dict = {} # request repo instance generated by different token
request_repo # request repo instance generated by token
assignee_candidates = {} # assignee candidates who will be assigned to handle issue
language_owner = {} # language owner who may handle issue
result = []
@ -397,12 +393,9 @@ class Common:
self.date_from_target = ''
self.package_name = ''
self.result = []
self.request_repo_dict = {}
self.request_repo = Github(assignee_token).get_repo(REQUEST_REPO)
self.issue_process_function = IssueProcess
for assignee in self.assignee_candidates:
self.request_repo_dict[assignee] = Github(assignee_token).get_repo(REQUEST_REPO)
@staticmethod
def for_test():
return bool(os.getenv("TEST_ISSUE_NUMBER"))
@ -439,7 +432,7 @@ class Common:
def proc_issue(self):
for item in self.issues_package:
issue = self.issue_process_function(item, self.request_repo_dict, self.assignee_candidates,
issue = self.issue_process_function(item, self.request_repo, self.assignee_candidates,
self.language_owner)
try:

Просмотреть файл

@ -24,9 +24,9 @@ _FILE_OUT = 'published_issues_python.csv'
class IssueProcessPython(IssueProcess):
def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Repository],
def __init__(self, issue_package: IssuePackage, request_repo: Repository,
assignee_candidates: Set[str], language_owner: Set[str]):
IssueProcess.__init__(self, issue_package, request_repo_dict, assignee_candidates, language_owner)
IssueProcess.__init__(self, issue_package, request_repo, assignee_candidates, language_owner)
self.output_folder = '' # network of sdk/network/azure-mgmt-XXX
self.delay_time = self.get_delay_time()
self.python_tag = ''