diff --git a/scripts/release_helper/common.py b/scripts/release_helper/common.py
index 101857f4c847..7c88fc8826d7 100644
--- a/scripts/release_helper/common.py
+++ b/scripts/release_helper/common.py
@@ -1,3 +1,4 @@
+from datetime import date, datetime
from typing import Set, List, Dict
import os
from utils import IssuePackage, REQUEST_REPO, AUTO_ASSIGN_LABEL, AUTO_PARSE_LABEL, get_origin_link_and_tag
@@ -6,6 +7,7 @@
import time
from github import Github
from github.Repository import Repository
+import subprocess as sp
_LOG = logging.getLogger(__name__)
@@ -15,6 +17,9 @@
# 'github assignee': 'token'
_ASSIGNEE_TOKEN = {'msyyc': os.getenv('PYTHON_MSYYC_TOKEN')}
+_SWAGGER_URL = 'https://github.com/Azure/azure-rest-api-specs/blob/main/specification'
+_SWAGGER_PULL = 'https://github.com/Azure/azure-rest-api-specs/pull'
+
_SWAGGER_URL = 'https://github.com/Azure/azure-rest-api-specs/blob/main/specification'
_SWAGGER_PULL = 'https://github.com/Azure/azure-rest-api-specs/pull'
@@ -75,7 +80,9 @@ def get_readme_from_pr_link(self, link: str) -> str:
if len(readme_link) > 1:
multi_link = ', '.join(readme_link)
pr = f"{_SWAGGER_PULL}/{pr_number}"
- self.comment(f'Hi, @{self.assignee}, by parsing {pr}, there are multi service link: {multi_link}. Please decide which one is the right.')
+ self.comment(
+ f'Hi, @{self.assignee}, by parsing {pr}, there are multi service link: {multi_link}. Please decide which one is the right.')
+
self.bot.append('multi readme link!')
raise Exception(f'multi link in "{pr}"')
@@ -196,10 +203,23 @@ def auto_assign(self) -> None:
self.update_issue_instance()
self.add_label(AUTO_ASSIGN_LABEL)
+ def bot_advice(self):
+ latest_comments = ''
+ comments = [(comment.updated_at.timestamp(), comment.user.login) for comment in
+ self.issue_package.issue.get_comments()]
+ comments.sort()
+ if comments:
+ latest_comments = comments[-1][1]
+ if self.issue_package.issue.comments == 0:
+ self.bot = 'new issue !
'
+ elif latest_comments not in self.language_owner:
+ self.bot = 'new comment.
'
+
def run(self) -> None:
# common part(don't change the order)
self.auto_assign() # necessary flow
self.auto_parse() # necessary flow
+ self.bot_advice()
class Common:
@@ -213,16 +233,53 @@ def __init__(self, issues: List[IssuePackage], assignee_token: Dict[str, str], l
self.issues_package = issues
self.assignee_candidates = set(assignee_token.keys())
self.language_owner = language_owner
+ # arguments add to language.md
+ self.file_out_name = 'common.md'
+ self.target_release_date = ''
+ self.date_from_target = ''
+ self.package_name = ''
+
for assignee in assignee_token:
self.request_repo_dict[assignee] = Github(assignee_token[assignee]).get_repo(REQUEST_REPO)
+ def output_md(self, items):
+ with open(self.file_out_name, 'w') as file_out:
+ file_out.write(
+ '| issue | author | package | assignee | bot advice | created date of issue | target release date | date from target |\n')
+ file_out.write('| ------ | ------ | ------ | ------ | ------ | ------ | ------ | :-----: |\n')
+ file_out.writelines([self.output_python(item) for item in items])
+
+ def output_python(self, item):
+ create_date = str(date.fromtimestamp(item.issue_package.issue.created_at.timestamp()).strftime('%m-%d'))
+
+ return '| [#{}]({}) | {} | {} | {} | {} | {} | {} | {} |\n'.format(
+ item.issue_package.issue.html_url.split('/')[-1],
+ item.issue_package.issue.html_url,
+ item.issue_package.issue.user.login,
+ self.package_name,
+ item.issue_package.issue.assignee.login,
+ item.bot,
+ create_date,
+ self.target_release_date,
+ self.date_from_target
+ )
+
+ @staticmethod
+ def push_md_to_storage():
+ cmd_list = ['git add .', 'git commit -m \"update excel\"', 'git push -f origin HEAD']
+ [sp.check_call(cmd, shell=True) for cmd in cmd_list]
+
def run(self):
+ items = []
for item in self.issues_package:
issue = IssueProcess(item, self.request_repo_dict, self.assignee_candidates, self.language_owner)
try:
issue.run()
+ items.append(issue)
except Exception as e:
_LOG.error(f'Error happened during handling issue {item.issue.number}: {e}')
+ self.output_md(items)
+
def common_process(issues: List[IssuePackage]):
diff --git a/scripts/release_helper/go.py b/scripts/release_helper/go.py
index 0405cd053be3..61464dd1c681 100644
--- a/scripts/release_helper/go.py
+++ b/scripts/release_helper/go.py
@@ -14,7 +14,9 @@ class IssueProcessGo(IssueProcess):
class Go(Common):
- pass
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Go, self).__init__(issues, assignee_token, language_owner)
+ self.file_out_name = 'release_go_status.md'
def go_process(issues: List[Any]):
diff --git a/scripts/release_helper/java.py b/scripts/release_helper/java.py
index 32d0185e63dc..d83e87ee1ae8 100644
--- a/scripts/release_helper/java.py
+++ b/scripts/release_helper/java.py
@@ -33,7 +33,10 @@ def auto_parse(self) -> None:
class Java(Common):
- pass
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Java, self).__init__(issues, assignee_token, language_owner)
+ self.file_out_name = 'release_java_status.md'
+
def java_process(issues: List[Any]):
diff --git a/scripts/release_helper/js.py b/scripts/release_helper/js.py
index e2515070cb44..e4532e28b90b 100644
--- a/scripts/release_helper/js.py
+++ b/scripts/release_helper/js.py
@@ -14,7 +14,9 @@ class IssueProcessJs(IssueProcess):
class Js(Common):
- pass
+ def __init__(self, issues, assignee_token, language_owner):
+ super(Js, self).__init__(issues, assignee_token, language_owner)
+ self.file_out_name = 'release_js_status.md'
def js_process(issues: List[Any]):
diff --git a/scripts/release_helper/main.py b/scripts/release_helper/main.py
index 5ee6e579622f..c58b1fb8e8f4 100644
--- a/scripts/release_helper/main.py
+++ b/scripts/release_helper/main.py
@@ -5,7 +5,8 @@
from go import go_process
from java import java_process
from js import js_process
-from common import common_process
+from common import common_process, Common
+
import os
from typing import List
@@ -54,6 +55,7 @@ def main():
for language in languages:
language_issues = select_language_issues(issues, language)
languages[language](language_issues)
+ Common.push_md_to_storage()
if __name__ == '__main__':
diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml
index 2f6bbc31a499..9023f73a5785 100644
--- a/scripts/release_helper/release_helper.yml
+++ b/scripts/release_helper/release_helper.yml
@@ -36,8 +36,8 @@ jobs:
git config --global user.name "ReleaseHelper"
# clone(REPO: https://github.com/Azure/azure-sdk-for-python.git, USR_NAME: Azure, USR_TOKEN: xxxxxxxxxxxxx)
- # mkdir file-storage
- # git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage
+ mkdir file-storage
+ git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage
# import env variable
export TOKEN=$(Yuchao-GitToken)
@@ -55,8 +55,8 @@ jobs:
pip install -r $script_path/requirement.txt
# checkout the target branch
- # cd file-storage
- # git checkout release-helper
+ cd file-storage
+ git checkout release-helper
# run
python $script_path/main.py