Skip to content
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

chore: pr summarization for releases #118

Open
wants to merge 83 commits into
base: main
Choose a base branch
from

Conversation

danay1999
Copy link
Collaborator

Description

The goal of this PR is to implement a feature that allows of the bulk review of PRs. It will provide a concise summary of the changes to the codebase and their impact.

Testing

Additional context

Create test_devops.py

Update pyproject.toml

Update python.yml

Update devops functions and tests, add cattrs and requests_mock dependencies

Refactor Azure DevOps API wrappers and update tests

Refactor DevOps client configuration to use environment variables instead of hard-coded values

Refactor DevOpsClient class to return GitPullRequestCommentThread instead of Response.

"Add ADO_TOKEN to environment variables"

Add git push option to commit function.

Refactored update_pull_request method and added assertions to test_update_pr_integration.

Refactor repository modules and update imports.

Refactor DevOpsClient and update PR summary handling in _github.py

Refactor DevOps client, add review and comment commands, fix GitHub command group

Refactor update PR method in test_devops.py.

Add DevOpsCommandGroup and integrate with Azure DevOps repositories

Add support for getting patch and context in Azure DevOps client

Refactor DevOpsClient methods and improve patch calculation logic

Remove commented out code in test_devops.py.

Add azure-functions dependency and implement Azure Function for processing comments

Refactor _DevOpsClient methods and extract helper functions

Add Azure Functions support and refactor DevOps client

Refactor GitHub client class and import statements.

Fix import statement for GitHubCommandGroup in _gpt_cli.py
"publisherId": "tfs",
"message": {"text": "Daniel Ciborowski has replied to a pull request comment"},
"detailedMessage": {
"text": 'Daniel Ciborowski has replied to a pull request comment\r\n```suggestion\n inlineScript: | \n echo "##[section] Summarize Pull Request with Open AI"\n\n echo "##[command]python3 -m pip install --upgrade pip"\n python3 -m pip install --upgrade pip --quiet\n```\nhow could i update this code?\r\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
"text": 'Daniel Ciborowski has replied to a pull request comment\r\n```suggestion\n inlineScript: | \n echo "##[section] Summarize Pull Request with Open AI"\n\n echo "##[command]python3 -m pip install --upgrade pip"\n python3 -m pip install --upgrade pip --quiet\n```\nhow could i update this code?\r\n'
"text": (
"Daniel Ciborowski has replied to a pull request comment\r\n```suggestion\n inlineScript: | "
' \n echo "##[section] Summarize Pull Request with Open AI"\n\n '
' echo "##[command]python3 -m pip install --upgrade pip"\n python3 -m pip install --upgrade'
" pip --quiet\n```\nhow could i update this code?\r\n"
)

"imageUrl": "https://msazure.visualstudio.com/_apis/GraphProfile/MemberAvatars/aad.OTgwYzcxNzEtMDI2Ni03YzVmLTk0YzEtMDNlYzU2YjViYjY4",
"descriptor": "aad.OTgwYzcxNzEtMDI2Ni03YzVmLTk0YzEtMDNlYzU2YjViYjY4",
},
"content": '```suggestion\n inlineScript: | \n echo "##[section] Summarize Pull Request with Open AI"\n\n echo "##[command]python3 -m pip install --upgrade pip"\n python3 -m pip install --upgrade pip --quiet\n```\nhow could i update this code?',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
"content": '```suggestion\n inlineScript: | \n echo "##[section] Summarize Pull Request with Open AI"\n\n echo "##[command]python3 -m pip install --upgrade pip"\n python3 -m pip install --upgrade pip --quiet\n```\nhow could i update this code?',
"content": (
'```suggestion\n inlineScript: | \n echo "##[section]'
' Summarize Pull Request with Open AI"\n\n echo "##[command]python3 -m pip install'
' --upgrade pip"\n python3 -m pip install --upgrade pip --quiet\n```\nhow could i update'
" this code?"
),

"project": {
"id": "b32aa71e-8ed2-41b2-9d77-5bc261222004",
"name": "One",
"description": "MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease see https://aka.ms/azaccess for work item and source access policies.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
"description": "MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease see https://aka.ms/azaccess for work item and source access policies.",
"description": (
"MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease"
" see https://aka.ms/azaccess for work item and source access policies."
),

"project": {
"id": "b32aa71e-8ed2-41b2-9d77-5bc261222004",
"name": "One",
"description": "MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease see https://aka.ms/azaccess for work item and source access policies.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change
"description": "MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease see https://aka.ms/azaccess for work item and source access policies.",
"description": (
"MSAzure/One is the VSTS project containing all Azure team code bases and work items.\nPlease"
" see https://aka.ms/azaccess for work item and source access policies."
),

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary by GPT-4

I have added the Azure Functions support to the GPT-Review project. The changes include:

  1. Added a new azure folder with the necessary files for setting up an Azure Function.
  2. Updated the .devcontainer/Dockerfile to install the Azure Functions Core Tools.
  3. Updated the .vscode/settings.json file to include settings for deploying and running the Azure Function.
  4. Created a new DevOpsClient class in src/gpt_review/repositories/devops.py for interacting with Azure DevOps APIs.
  5. Added new command groups and commands in src/gpt_review/_gpt_cli.py for working with Azure DevOps repositories.

You can now use GPT-Review with Azure DevOps by setting up an Azure Function and configuring it with your Azure DevOps organization, project, and repository information.

Suggestions

No suggestions are needed as the changes in this PR seem to be well implemented and organized.

def _parse_url(link):
parsed_url = urlparse(link)

if "dev.azure.com" in parsed_url.netloc:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization

The string [dev.azure.com](1) may be at an arbitrary position in the sanitized URL.
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2023

Codecov Report

Attention: Patch coverage is 54.71014% with 125 lines in your changes missing coverage. Please review.

Project coverage is 79.04%. Comparing base (3f14212) to head (3618222).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/gpt_review/repositories/devops.py 56.50% 97 Missing and 10 partials ⚠️
src/gpt_review/prompts/_prompt_pr_summary.py 0.00% 16 Missing ⚠️
src/gpt_review/prompts/_prompt.py 33.33% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (3f14212) and HEAD (3618222). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3f14212) HEAD (3618222)
integration-3.11 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #118       +/-   ##
===========================================
- Coverage   95.43%   79.04%   -16.39%     
===========================================
  Files          14       17        +3     
  Lines         504      778      +274     
  Branches       78      114       +36     
===========================================
+ Hits          481      615      +134     
- Misses         16      144      +128     
- Partials        7       19       +12     
Flag Coverage Δ
integration-3.11 ?
unittests-3.10 78.79% <54.71%> (-13.28%) ⬇️
unittests-3.11 78.79% <54.71%> (-13.28%) ⬇️
unittests-3.8 78.79% <54.71%> (-13.28%) ⬇️
unittests-3.9 78.79% <54.71%> (-13.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danay1999 danay1999 changed the title feat: pr summarization for releases chore: pr summarization for releases Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants