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 #1429

Merged
merged 30 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 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
e50f233
try adding a setting as an env var instead
somesylvie Oct 15, 2024
3c777b4
Merge branch 'main' into pr-agent
somesylvie Oct 15, 2024
b6e79a7
remove setting that's also in the toml
somesylvie Oct 15, 2024
93b62c6
remove unneeded trigger
somesylvie Oct 15, 2024
a87ab5f
add helpful comments for posterity
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
30 changes: 30 additions & 0 deletions .github/workflows/pr_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Perry the PR Agent Platypus
somesylvie marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
pull_request_review_comment:

Choose a reason for hiding this comment

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

Remove the trigger for 'pull_request_review_comment' to align with the ticket requirements. This can be done by deleting lines 5 and 6 from the workflow file. [important]

Choose a reason for hiding this comment

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

Remove the trigger for 'pull_request_review_comment' to comply with the ticket requirements. This can be done by removing lines 5-6 from the workflow file. [important]

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.
pr_description.publish_labels: 'false'
43 changes: 43 additions & 0 deletions .pr_agent.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[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)

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

# See https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml for all possible config options

[pr_reviewer] # /review #
# enable/disable features
# 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
persistent_comment=false
#automatic_review=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.

[pr_description] # /describe #
publish_labels=false
# describe as comment
publish_description_as_comment=true
publish_description_as_comment_persistent=false

[pr_code_suggestions] # /improve #
persistent_comment=false