-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add auto-close and auto-run-pipline #20516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
2c563ff
release_iseus_status_auto_reply
RAY-316 9603d0f
issue_aoto_close_revert
RAY-316 133a6a0
Update main.py
RAY-316 d37ca66
Update main.py
RAY-316 f5a24c8
Update update_issue_body.py
RAY-316 590dc3d
Update reply_generator.py
BigCat20196 0a20a20
Update reply_generator.py
BigCat20196 1644cf1
Update update_issue_body.py
BigCat20196 6b1f482
Update main.py
BigCat20196 fafae8e
Update update_issue_body.py
BigCat20196 fba944d
Update update_issue_body.py
BigCat20196 256fb62
Update main.py
BigCat20196 ff27a87
Update reply_generator.py
RAY-316 9bbde53
Update main.py
RAY-316 c065cf7
Update update_issue_body.py
BigCat20196 80007ac
Update main.py
BigCat20196 bef41b1
Update scripts/release_issue_status/update_issue_body.py
msyyc 2682c0e
Update update_issue_body.py
BigCat20196 af36ccc
Update main.py
BigCat20196 9223146
Update reply_generator.py
BigCat20196 8ee91fe
Update update_issue_body.py
BigCat20196 bef133c
Update main.py
BigCat20196 9dfd084
Update scripts/release_issue_status/main.py
msyyc 51f92fd
Update main.py
msyyc 5259157
Update scripts/release_issue_status/main.py
msyyc 6949bfb
Update scripts/release_issue_status/main.py
msyyc 7b14fd2
Update scripts/release_issue_status/main.py
msyyc 299cfae
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
msyyc 7d3fab8
Update scripts/release_issue_status/update_issue_body.py
msyyc f07b5b2
Update scripts/release_issue_status/main.py
BigCat20196 b39342b
Update scripts/release_issue_status/update_issue_body.py
BigCat20196 44d4de9
Update reply_generator.py
RAY-316 86b603a
Update main.py
RAY-316 b9abd0f
Update scripts/release_issue_status/update_issue_body.py
BigCat20196 7ae26ce
Update scripts/release_issue_status/update_issue_body.py
BigCat20196 e4b3ed8
Update reply_generator.py
RAY-316 b587233
Update update_issue_body.py
BigCat20196 5ca4ac1
Update main.py
BigCat20196 262d323
Update main.py
BigCat20196 df737f2
Update update_issue_body.py
BigCat20196 b792d31
Update main.py
BigCat20196 c34adbf
Update scripts/release_issue_status/main.py
msyyc 962683e
Update main.py
RAY-316 b59c2b9
Update reply_generator.py
RAY-316 91f6827
Update main.py
BigCat20196 2cbf44a
Update main.py
BigCat20196 28f1be0
Update main.py
BigCat20196 9c6adec
Update main.py
BigCat20196 d021e85
Update main.py
BigCat20196 9f05d43
Update main.py
BigCat20196 3a83841
Update main.py
BigCat20196 05cf904
Update main.py
BigCat20196 529ed24
Update main.py
BigCat20196 ad02d86
Update update_issue_body.py
BigCat20196 d8c9fd2
Update main.py
BigCat20196 e5fd8a1
Update update_issue_body.py
BigCat20196 5be276a
Update reply_generator.py
RAY-316 a49bcde
Update update_issue_body.py
BigCat20196 cb053b0
Update main.py
RAY-316 7775550
Update update_issue_body.py
BigCat20196 4799c39
Update update_issue_body.py
BigCat20196 c44d538
Update update_issue_body.py
BigCat20196 963d458
Update update_issue_body.py
BigCat20196 8134df9
Update update_issue_body.py
BigCat20196 c710901
Update main.py
BigCat20196 bc261c9
Update main.py
BigCat20196 ca1f2e3
Merge branch 'release-issue-status' of https://github.com/msyyc/azure…
BigCat20196 fa6fa24
Update release_issue_status.yml for Azure Pipelines
RAY-316 f53f376
Update main.py
RAY-316 767620a
Update reply_generator.py
RAY-316 2b8aab5
Add files via upload
RAY-316 e03a92d
Update reply_generator.py
RAY-316 ce5bde7
Update update_issue_body.py
BigCat20196 984028f
Update reply_generator.py
RAY-316 5be7416
Update auto_pipeline_run.py
RAY-316 b952cc8
Update auto_pipeline_run.py
RAY-316 8b52ed0
add auto-close
BigCat20196 f9c76f9
Update release_issue_status.yml for Azure Pipelines
RAY-316 f6a0b9b
Update auto_close.py
BigCat20196 ad78829
Update main.py
BigCat20196 e52fbde
Update release_issue_status.yml for Azure Pipelines
RAY-316 8cc6d6a
Update auto_pipeline_run.py
RAY-316 6b56d8e
fix bug
BigCat20196 db9fe0d
Merge branch 'release-issue-status' of https://github.com/msyyc/azure…
BigCat20196 bea9433
Update main.py
BigCat20196 10dbe82
Update auto_close.py
BigCat20196 3716dd0
Update auto_close.py
BigCat20196 94e5764
Update main.py
BigCat20196 ed82ba7
Update reply_generator.py
RAY-316 ac890c3
Update main.py
BigCat20196 2adc725
Update main.py
BigCat20196 b312aa2
Update auto_close.py
BigCat20196 bf8f448
Update main.py
BigCat20196 f65954c
Update auto-close
BigCat20196 96da96a
Update auto_pipeline_run.py
RAY-316 683d403
Update update_issue_body.py
BigCat20196 beca5ff
Update auto_pipeline_run.py
RAY-316 6508c48
Update release_issue_status.yml for Azure Pipelines
RAY-316 662e74f
Update auto_pipeline_run.py
RAY-316 4b661c6
Update release_issue_status.yml for Azure Pipelines
RAY-316 05733eb
Update auto_pipeline_run.py
RAY-316 7639430
Update auto_pipeline_run.py
RAY-316 45ef56d
Add pipeline link
BigCat20196 cf044d6
Update pipeline link
BigCat20196 a367116
Update auto_pipeline_run.py
BigCat20196 c9073c9
Update release_issue_status.yml for Azure Pipelines
RAY-316 7d74b1d
Update auto_pipeline_run.py
RAY-316 bfdfd38
Update requirement.txt
RAY-316 6ebcb7e
Update auto_pipeline_run.py
RAY-316 a54dd83
Add get_python_pipeline
BigCat20196 6cadcda
Update auto_pipeline_run.py
RAY-316 e26e54a
test
BigCat20196 cdeb1c6
Merge branch 'release-issue-status' of https://github.com/msyyc/azure…
BigCat20196 57faca1
test
BigCat20196 8faa0e3
add outputfolder
BigCat20196 152d689
add label
BigCat20196 6870777
Update main.py
msyyc d76eb9f
Update get_python_pipeline.py
BigCat20196 1f19dd8
Update main.py
BigCat20196 80b0ec6
Update auto_pipeline_run.py
RAY-316 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import datetime | ||
|
|
||
| import requests | ||
| from bs4 import BeautifulSoup | ||
|
|
||
|
|
||
| def auto_close_issue(sdk_repo, item): | ||
| issue_number, package_name = item.issue_object.number, item.package | ||
| issue_info = sdk_repo.get_issue(number=issue_number) | ||
| issue_author = issue_info.user.login | ||
| last_comment = list(issue_info.get_comments())[-1] | ||
| last_comment_date = last_comment.created_at | ||
| last_version, last_time = get_last_released_date(package_name) | ||
| if last_time and last_time > last_comment_date: | ||
| comment = f'Hi @{issue_author}, pypi link: https://pypi.org/project/{package_name}/{last_version}/' | ||
| issue_info.create_comment(body=comment) | ||
| issue_info.edit(state='closed') | ||
| item.labels.append('auto-closed') | ||
| item.issue_object.set_labels(*item.labels) | ||
| print(f"issue number:{issue_number} has been closed!") | ||
|
|
||
|
|
||
| def get_last_released_date(package_name): | ||
| pypi_link = f'https://pypi.org/project/{package_name}/#history' | ||
| res = requests.get(pypi_link) | ||
| soup = BeautifulSoup(res.text, 'html.parser') | ||
| # find top div from <div class="release-timeline"> | ||
| try: | ||
| package_info = soup.select('div[class="release-timeline"]')[0].find_all('div')[0] | ||
| last_version_mix = package_info.find_all('p', class_="release__version")[0].contents[0] | ||
| except IndexError as e: | ||
| return '', '' | ||
| last_version = last_version_mix.replace(' ', '').replace('\n', '') | ||
| last_version_date_str = package_info.time.attrs['datetime'].split('+')[0] | ||
| last_version_date = datetime.datetime.strptime(last_version_date_str, '%Y-%m-%dT%H:%M:%S') | ||
| return last_version, last_version_date | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import json | ||
| import os | ||
| import re | ||
| from msrest.authentication import BasicAuthentication | ||
| from azure.devops.v6_0.pipelines.pipelines_client import PipelinesClient | ||
| from azure.devops.v6_0.pipelines import models | ||
| import requests | ||
|
|
||
|
|
||
| def run_pipeline(issue_link, sdk_issue_object, pipeline_url): | ||
| paramaters = { | ||
| "stages_to_skip": [], | ||
| "resources": { | ||
| "repositories": { | ||
| "self": { | ||
| "refName": "refs/heads/main" | ||
| } | ||
| } | ||
| }, | ||
| "variables": { | ||
| "BASE_BRANCH": { | ||
| "value": f"{sdk_issue_object.head.label}", | ||
| "isSecret": False | ||
| }, | ||
| "ISSUE_LINK": { | ||
| "value": f"{issue_link}", | ||
| "isSecret": False | ||
| }, | ||
| "PIPELINE_LINK": { | ||
| "value": f"{pipeline_url}", | ||
| "isSecret": False | ||
| } | ||
| } | ||
| } | ||
| # Fill in with your personal access token and org URL | ||
| personal_access_token = os.getenv('PIPELINE_TOKEN') | ||
| organization_url = 'https://dev.azure.com/azure-sdk' | ||
|
|
||
| # Create a connection to the org | ||
| credentials = BasicAuthentication('', personal_access_token) | ||
| run_parameters = models.RunPipelineParameters(**paramaters) | ||
| client = PipelinesClient(base_url=organization_url, creds=credentials) | ||
| result = client.run_pipeline(project='internal',pipeline_id=2500,run_parameters=run_parameters) | ||
| if result.state == 'inProgress': | ||
| return True | ||
| else: | ||
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import os | ||
| import re | ||
|
|
||
| from msrest.authentication import BasicAuthentication | ||
| from azure.devops.v6_0.pipelines.pipelines_client import PipelinesClient | ||
|
|
||
|
|
||
| def get_python_pipelines(): | ||
| python_piplines = {} | ||
| pipeline_client = PipelinesClient(base_url='https://dev.azure.com/azure-sdk', | ||
| creds=BasicAuthentication('', os.getenv('PIPELINE_TOKEN'))) | ||
| pipelines = pipeline_client.list_pipelines(project='internal') | ||
| for pipeline in pipelines: | ||
| if re.findall('^python - \w*$', pipeline.name): | ||
| key = pipeline.name.replace('python - ', '') | ||
| python_piplines[key] = pipeline.id | ||
| return python_piplines | ||
|
|
||
|
|
||
| def get_pipeline_url(python_piplines, output_folder): | ||
| definitionId = python_piplines.get(output_folder) | ||
| if definitionId: | ||
| pipeline_url = 'https://dev.azure.com/azure-sdk/internal/_build?definitionId={}'.format(definitionId) | ||
| else: | ||
| print('Cannot find definitionId, Do not display pipeline_url') | ||
| pipeline_url = '' | ||
| return pipeline_url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| PyGithub | ||
| datetime | ||
| azure.storage.blob==12.8.1 | ||
| requests | ||
| bs4 | ||
| azure.storage.blob==12.8.1 | ||
| azure-devops | ||
| msrest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.