Merge branch 'main' of https://github.com/Codium-ai/pr-agent into fix_bitbucket_pipeline

This commit is contained in:
sarbjitgrewal
2023-09-21 12:48:32 +05:30
4 changed files with 43 additions and 7 deletions

View File

@ -123,7 +123,7 @@ jobs:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }} OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
** if you want to pin your action to a specific commit for stability reasons ** if you want to pin your action to a specific release (v0.7 for example) for stability reasons, use:
```yaml ```yaml
on: on:
pull_request: pull_request:
@ -140,7 +140,7 @@ jobs:
steps: steps:
- name: PR Agent action step - name: PR Agent action step
id: pragent id: pragent
uses: Codium-ai/pr-agent@<commit_sha> uses: Codium-ai/pr-agent@v0.7
env: env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }} OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -32,6 +32,8 @@ CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull
See the [usage guide](./Usage.md) for instructions how to run the different tools from [CLI](./Usage.md#working-from-a-local-repo-cli), or by [online usage](./Usage.md#online-usage), as well as additional details on optional commands and configurations. See the [usage guide](./Usage.md) for instructions how to run the different tools from [CLI](./Usage.md#working-from-a-local-repo-cli), or by [online usage](./Usage.md#online-usage), as well as additional details on optional commands and configurations.
[Release notes](./RELEASE_NOTES.md)
<h3>Example results:</h3> <h3>Example results:</h3>
</div> </div>
<h4><a href="https://github.com/Codium-ai/pr-agent/pull/229#issuecomment-1687561986">/describe:</a></h4> <h4><a href="https://github.com/Codium-ai/pr-agent/pull/229#issuecomment-1687561986">/describe:</a></h4>

25
RELEASE_NOTES.md Normal file
View File

@ -0,0 +1,25 @@
## [Version 0.7] - 2023-09-20
### Docker Tags
- codiumai/pr-agent:0.7
- codiumai/pr-agent:0.7-github_app
- codiumai/pr-agent:0.7-bitbucket-app
- codiumai/pr-agent:0.7-gitlab_webhook
- codiumai/pr-agent:0.7-github_polling
- codiumai/pr-agent:0.7-github_action
### Added::Algo
- New tool /similar_issue - Currently on GitHub app and CLI: indexes the issues in the repo, find the most similar issues to the target issue.
- Describe markers: Empower the /describe tool with a templating capability (see more details in https://github.com/Codium-ai/pr-agent/pull/273).
- New feature in the /review tool - added an estimated effort estimation to the review (https://github.com/Codium-ai/pr-agent/pull/306).
### Added::Infrastructure
- Implementation of a GitLab webhook.
- Implementation of a BitBucket app.
### Fixed
- Protection against no code suggestions generated.
- Resilience to repositories where the languages cannot be automatically detected.

View File

@ -40,12 +40,16 @@ def extend_patch(original_file_str, patch_str, num_lines) -> str:
extended_patch_lines.extend( extended_patch_lines.extend(
original_lines[start1 + size1 - 1:start1 + size1 - 1 + num_lines]) original_lines[start1 + size1 - 1:start1 + size1 - 1 + num_lines])
res = list(match.groups())
for i in range(len(res)):
if res[i] is None:
res[i] = 0
try: try:
start1, size1, start2, size2 = map(int, match.groups()[:4]) start1, size1, start2, size2 = map(int, res[:4])
except: # '@@ -0,0 +1 @@' case except: # '@@ -0,0 +1 @@' case
start1, size1, size2 = map(int, match.groups()[:3]) start1, size1, size2 = map(int, res[:3])
start2 = 0 start2 = 0
section_header = match.groups()[4] section_header = res[4]
extended_start1 = max(1, start1 - num_lines) extended_start1 = max(1, start1 - num_lines)
extended_size1 = size1 + (start1 - extended_start1) + num_lines extended_size1 = size1 + (start1 - extended_start1) + num_lines
extended_start2 = max(1, start2 - num_lines) extended_start2 = max(1, start2 - num_lines)
@ -207,10 +211,15 @@ __old hunk__
old_content_lines = [] old_content_lines = []
if match: if match:
prev_header_line = header_line prev_header_line = header_line
res = list(match.groups())
for i in range(len(res)):
if res[i] is None:
res[i] = 0
try: try:
start1, size1, start2, size2 = map(int, match.groups()[:4]) start1, size1, start2, size2 = map(int, res[:4])
except: # '@@ -0,0 +1 @@' case except: # '@@ -0,0 +1 @@' case
start1, size1, size2 = map(int, match.groups()[:3]) start1, size1, size2 = map(int, res[:3])
start2 = 0 start2 = 0
elif line.startswith('+'): elif line.startswith('+'):