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 21 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
29 changes: 29 additions & 0 deletions .github/workflows/pr_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Perry the PR Agent Platypus
saquino0827 marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
pull_request_review_comment:
Copy link
Contributor

Choose a reason for hiding this comment

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

unsure if this worked

Copy link
Contributor

Choose a reason for hiding this comment

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

/review

Copy link
Contributor

Choose a reason for hiding this comment

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

/describe

Copy link
Contributor

Choose a reason for hiding this comment

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

/review

Copy link
Contributor

Choose a reason for hiding this comment

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

/describe

Copy link
Contributor

Choose a reason for hiding this comment

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

/improve

Copy link
Contributor

Choose a reason for hiding this comment

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

/review

types: [created]
issue_comment:
types: [created]
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.
42 changes: 42 additions & 0 deletions .pr_agent.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[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 = false
auto_improve = true
pr_actions = ["opened", "reopened", "ready_for_review", "review_requested"]

[pr_reviewer] # /review #
# enable/disable features
require_score_review=false # If set to true, the tool will add a section that scores the PR. Default is false.
require_tests_review=true #If set to true, the tool will add a section that checks if the PR contains tests. Default is true.
require_estimate_effort_to_review=true # If set to true, the tool will add a section that estimates the effort needed to review the PR. Default is true.
require_can_be_split_review=false # If set to true, the tool will add a section that checks if the PR contains several themes, and can be split into smaller PRs. Default is false.
require_security_review=true # If set to true, the tool will add a section that checks if the PR contains a possible security or vulnerability issue. Default is true.
require_ticket_analysis_review=true # If set to true, and the PR contains a GitHub ticket number, the tool will add a section that checks if the PR in fact fulfilled the ticket requirements. Default is true.
# general options
num_code_suggestions=3 # Number of code suggestions provided by the 'review' tool. Default is 0, meaning no code suggestions will be provided by the `review` tool.
inline_code_comments = true # If set to true, the tool will publish the code suggestions as comments on the code diff. Default is false. Note that you need to set `num_code_suggestions`>0 to get code suggestions
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 # If set to true, the review comment will be persistent, meaning that every new review request will edit the previous one. Default is true.
extra_instructions = "" # Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...".
final_update_message = true # If set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/Codium-ai/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`. Default is false.
# review labels
enable_review_labels_security=false # If set to true, the tool will publish a 'possible security issue' label if it detects a security issue. Default is true.
enable_review_labels_effort=false # If set to true, the tool will publish a 'Review effort [1-5]: x' label. Default is 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 # If set to true, the tool will approve the PR when invoked with the 'auto_approve' command. Default is false. This flag can be changed only from a configuration file.
maximal_review_effort=5 # Maximal effort level for auto-approval. If the PR's estimated review effort is above this threshold, the auto-approval will not run. Default is 5.

[pr_description] # /describe #
publish_labels=false