mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-19 20:10:39 +08:00
Merge remote-tracking branch 'origin/main' into tr/readme
This commit is contained in:
4
.github/workflows/pr-agent-review.yaml
vendored
4
.github/workflows/pr-agent-review.yaml
vendored
@ -21,8 +21,8 @@ jobs:
|
|||||||
id: pragent
|
id: pragent
|
||||||
uses: Codium-ai/pr-agent@main
|
uses: Codium-ai/pr-agent@main
|
||||||
env:
|
env:
|
||||||
OPENAI.KEY: ${{ secrets.OPENAI_KEY }}
|
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
|
||||||
OPENAI.ORG: ${{ secrets.OPENAI_ORG }} # optional
|
OPENAI_ORG: ${{ secrets.OPENAI_ORG }} # optional
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
PINECONE.API_KEY: ${{ secrets.PINECONE_API_KEY }}
|
PINECONE.API_KEY: ${{ secrets.PINECONE_API_KEY }}
|
||||||
PINECONE.ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
|
PINECONE.ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
|
||||||
|
@ -12,8 +12,8 @@ async def run_action():
|
|||||||
# Get environment variables
|
# Get environment variables
|
||||||
GITHUB_EVENT_NAME = os.environ.get('GITHUB_EVENT_NAME')
|
GITHUB_EVENT_NAME = os.environ.get('GITHUB_EVENT_NAME')
|
||||||
GITHUB_EVENT_PATH = os.environ.get('GITHUB_EVENT_PATH')
|
GITHUB_EVENT_PATH = os.environ.get('GITHUB_EVENT_PATH')
|
||||||
OPENAI_KEY = os.environ.get('OPENAI_KEY')
|
OPENAI_KEY = os.environ.get('OPENAI_KEY') or os.environ.get('OPENAI.KEY')
|
||||||
OPENAI_ORG = os.environ.get('OPENAI_ORG')
|
OPENAI_ORG = os.environ.get('OPENAI_ORG') or os.environ.get('OPENAI.ORG')
|
||||||
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
|
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
|
||||||
get_settings().set("CONFIG.PUBLISH_OUTPUT_PROGRESS", False)
|
get_settings().set("CONFIG.PUBLISH_OUTPUT_PROGRESS", False)
|
||||||
|
|
||||||
@ -61,12 +61,21 @@ async def run_action():
|
|||||||
if action in ["created", "edited"]:
|
if action in ["created", "edited"]:
|
||||||
comment_body = event_payload.get("comment", {}).get("body")
|
comment_body = event_payload.get("comment", {}).get("body")
|
||||||
if comment_body:
|
if comment_body:
|
||||||
pr_url = event_payload.get("issue", {}).get("pull_request", {}).get("url")
|
is_pr = False
|
||||||
if pr_url:
|
# check if issue is pull request
|
||||||
|
if event_payload.get("issue", {}).get("pull_request"):
|
||||||
|
url = event_payload.get("issue", {}).get("pull_request", {}).get("url")
|
||||||
|
is_pr = True
|
||||||
|
else:
|
||||||
|
url = event_payload.get("issue", {}).get("url")
|
||||||
|
if url:
|
||||||
body = comment_body.strip().lower()
|
body = comment_body.strip().lower()
|
||||||
comment_id = event_payload.get("comment", {}).get("id")
|
comment_id = event_payload.get("comment", {}).get("id")
|
||||||
provider = get_git_provider()(pr_url=pr_url)
|
provider = get_git_provider()(pr_url=url)
|
||||||
await PRAgent().handle_request(pr_url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
|
if is_pr:
|
||||||
|
await PRAgent().handle_request(url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
|
||||||
|
else:
|
||||||
|
await PRAgent().handle_request(url, body)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -11,6 +11,7 @@ ai_timeout=180
|
|||||||
max_description_tokens = 500
|
max_description_tokens = 500
|
||||||
max_commits_tokens = 500
|
max_commits_tokens = 500
|
||||||
secret_provider="google_cloud_storage"
|
secret_provider="google_cloud_storage"
|
||||||
|
cli_mode=false
|
||||||
|
|
||||||
[pr_reviewer] # /review #
|
[pr_reviewer] # /review #
|
||||||
require_focused_review=false
|
require_focused_review=false
|
||||||
|
Reference in New Issue
Block a user