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

OpenAI PR Agent Setup #1405

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
592e947
added initial setup for openai pr agent
pluckyswan Oct 9, 2024
8ec8364
remove .toml file and renamed env
pluckyswan Oct 9, 2024
6c083eb
readd .toml file
pluckyswan Oct 9, 2024
e71443d
Add some env variables to pr_agent
saquino0827 Oct 10, 2024
b6a1359
change pr trigger on all PR updates
saquino0827 Oct 10, 2024
595737d
Adding every configuration combination possible
saquino0827 Oct 10, 2024
1ce9caa
Update API version
saquino0827 Oct 10, 2024
a8b1b54
Update PR agent name for testing purposes
saquino0827 Oct 10, 2024
68f0394
Update github actions in configurations
saquino0827 Oct 10, 2024
a6ddf8e
Testing next set of configurations
saquino0827 Oct 10, 2024
48906b1
Remove suggested invalid configurations
saquino0827 Oct 10, 2024
f425351
Update env variables to match our github secrets
saquino0827 Oct 10, 2024
0547def
Remove github settings from workflow and add to the .toml file
saquino0827 Oct 10, 2024
416ffe1
update settings
saquino0827 Oct 10, 2024
21e31f9
Add review settings to toml file
saquino0827 Oct 10, 2024
98813f4
Add preview to the azure version
saquino0827 Oct 10, 2024
add342d
add inline code comments and update comments
pluckyswan Oct 10, 2024
4f5f36a
added comments for existing configuration and turned off labeling and…
pluckyswan Oct 14, 2024
b885e9b
specify type for `issue_comment`
somesylvie Oct 15, 2024
8f18153
add additional trigger since `issue_comment` only works if workflow i…
somesylvie Oct 15, 2024
4448436
let's see if we can stop labeling so much
somesylvie Oct 15, 2024
b80ee66
remove settings that are default; add a link to example settings
somesylvie Oct 15, 2024
c9f1a28
Merge branch 'main' into pr-agent
saquino0827 Oct 15, 2024
c0e5dba
adjust some more settings
somesylvie Oct 15, 2024
94d1509
one more
somesylvie Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/pr_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Perry the PR Agent Platypus
saquino0827 marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
issue_comment:
jobs:
pr_agent_job:
if: ${{ github.event.sender.type != 'Bot' }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
name: Run pr agent on every pull request, respond to user comments
steps:
- name: PR Agent action step
id: pragent
uses: Codium-ai/pr-agent@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
OPENAI.API_TYPE: 'azure'
OPENAI.API_BASE: ${{ secrets.AZURE_OPENAI_BASE_URL }}
OPENAI.DEPLOYMENT_ID: ${{ secrets.AZURE_OPENAI_DEPLOYMENT_ID }}
OPENAI_API_VERSION: '2023-03-15'
AZURE_API_VERSION: '2023-03-15-preview' # Specific version required to address compatibility issues with GPT-4 deployment on Azure.
39 changes: 39 additions & 0 deletions .pr_agent.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[config]
model="gpt-4" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo)
model_turbo="gpt-4" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo)
fallback_models=["gpt-4"] # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo)
saquino0827 marked this conversation as resolved.
Show resolved Hide resolved

[github_action_config]
auto_review = true
auto_describe = true
auto_improve = true
pr_actions = ["opened", "reopened", "ready_for_review", "review_requested"]

[pr_reviewer] # /review #
# enable/disable features
require_score_review=false
require_tests_review=true
require_estimate_effort_to_review=true
require_can_be_split_review=false
require_security_review=true
require_ticket_analysis_review=true
# general options
num_code_suggestions=0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious about some of these settings - it might be helpful to either link out to docs or add comments explaining why non-obvious things are set certain ways (like this PR Agent actually suggests having a non-0 number for this setting, but I don't entirely understand what it does)

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a fair point. I'd have to see where they have docs for these settings because I only found a link to their example settings and not an explanation of the settings themselves.

inline_code_comments = true
ask_and_reflect=false
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious to know what ask_and_reflect does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it'll rate its own code suggestions
Screenshot 2024-10-14 at 1 40 40 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be worth adding this option if there's no drawback to set that on

#automatic_review=true
persistent_comment=true
extra_instructions = ""
final_update_message = true
# review labels
enable_review_labels_security=true
enable_review_labels_effort=true
# specific configurations for incremental review (/review -i)
require_all_thresholds_for_incremental_review=false
minimal_commits_for_incremental_review=0
minimal_minutes_for_incremental_review=0
enable_intro_text=true
enable_help_text=false # Determines whether to include help text in the PR review. Enabled by default.
# auto approval
enable_auto_approval=false
maximal_review_effort=5