auto commands in github action

This commit is contained in:
mrT23
2023-09-25 18:01:32 +03:00
parent ba78475944
commit 8f81c18647
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import os
from pr_agent.agent.pr_agent import PRAgent
from pr_agent.config_loader import get_settings
from pr_agent.git_providers import get_git_provider
from pr_agent.tools.pr_code_suggestions import PRCodeSuggestions
from pr_agent.tools.pr_description import PRDescription
from pr_agent.tools.pr_reviewer import PRReviewer
@ -53,7 +55,15 @@ async def run_action():
if action in ["opened", "reopened"]:
pr_url = event_payload.get("pull_request", {}).get("url")
if pr_url:
await PRReviewer(pr_url).run()
auto_review = os.environ.get('github_action.auto_review')
if auto_review is None or auto_review.lower() == 'true':
await PRReviewer(pr_url).run()
auto_describe = os.environ.get('github_action.auto_describe')
if auto_describe.lower() == 'true':
await PRDescription(pr_url).run()
auto_improve = os.environ.get('github_action.auto_improve')
if auto_improve.lower() == 'true':
await PRCodeSuggestions(pr_url).run()
# Handle issue comment event
elif GITHUB_EVENT_NAME == "issue_comment":

View File

@ -58,6 +58,11 @@ extra_instructions = ""
deployment_type = "user"
ratelimit_retries = 5
[github_action]
# auto_review = true # set as env var in .github/workflows/pr-agent.yml
# auto_describe = true # set as env var in .github/workflows/pr-agent.yaml
# auto_improve = true # set as env var in .github/workflows/pr-agent.yaml
[github_app]
# these toggles allows running the github app from custom deployments
bot_user = "github-actions[bot]"