diff --git a/scripts/auto_release/PythonSdkLiveTest.yml b/scripts/auto_release/PythonSdkLiveTest.yml index 433ecaa81a4d..5f1534ced6b0 100644 --- a/scripts/auto_release/PythonSdkLiveTest.yml +++ b/scripts/auto_release/PythonSdkLiveTest.yml @@ -55,6 +55,9 @@ jobs: export AZURE_CLIENT_ID=$(ENV_CLIENT_ID) export AZURE_CLIENT_SECRET=$(ENV_CLIENT_SECRET) export AZURE_SUBSCRIPTION_ID=$(ENV_SUBSCRIPTION_ID) + export ISSUE_LINK=$(ISSUE_LINK) + export UPDATE_TOKEN=$(UPDATE_TOKEN) + export USR_TOKEN=$(USR_TOKEN) # run cd azure-sdk-for-python @@ -74,12 +77,9 @@ jobs: # create PR export NEW_BRANCH=`sed -n '1p' $output_path/output.txt` export TARGET_BRANCH=`sed -n '2p' $output_path/output.txt` - export ISSUE_LINK=$(ISSUE_LINK) export PIPELINE_LINK=$(PIPELINE_LINK) export USR_NAME=$(USR_NAME) - export USR_TOKEN=$(USR_TOKEN) export TEST_RESULT=$test_result - export UPDATE_TOKEN=$(UPDATE_TOKEN) python $script_path/create_auto_release_pr.py echo "\'[AutoRelease] $new_branch \' has been created!!!" diff --git a/scripts/auto_release/create_auto_release_pr.py b/scripts/auto_release/create_auto_release_pr.py index 9dafa7213691..553859127018 100644 --- a/scripts/auto_release/create_auto_release_pr.py +++ b/scripts/auto_release/create_auto_release_pr.py @@ -15,6 +15,6 @@ def main(): # Add issue link on PR api = GhApi(owner='Azure', repo='azure-sdk-for-python', token=os.getenv('UPDATE_TOKEN')) api.issues.create_comment(issue_number=pr_number, body='issue link:{}'.format(os.getenv('ISSUE_LINK'))) - + if __name__ == '__main__': main() diff --git a/scripts/auto_release/main.py b/scripts/auto_release/main.py index d8a923ceea16..ee05ff4177a2 100644 --- a/scripts/auto_release/main.py +++ b/scripts/auto_release/main.py @@ -4,6 +4,7 @@ import time import argparse import logging +from ghapi.all import GhApi SERVICE_NAME = 'servicename' @@ -157,6 +158,12 @@ def edit_version(add_content): if TRACK == '1' and VERSION_LAST_RELEASE[0] == '0': num = VERSION_LAST_RELEASE.split('.') VERSION_NEW = f'{num[0]}.{int(num[1]) + 1}.0' + # '0.0.0' means there must be abnormal situation + if VERSION_NEW == '0.0.0': + api_request = GhApi(owner='Azure', repo='sdk-release-request', token=os.getenv('UPDATE_TOKEN')) + link = os.getenv('ISSUE_LINK') + issue_number = link.split('/')[-1] + api_request.issues.add_labels(issue_number=int(issue_number), labels=['base-branch-attention']) def edit_changelog(add_content): @@ -459,4 +466,5 @@ def main(): my_print(e) else: with open(f'{OUT_PATH}/output.txt', 'w') as file_out: - file_out.writelines([f'{NEW_BRANCH}\n', "main" if TRACK == '2' else 'release/v3']) + file_out.writelines([f'{NEW_BRANCH}\n', "main\n" if TRACK == '2' else 'release/v3\n']) +