diff --git a/pr_agent/servers/github_action_runner.py b/pr_agent/servers/github_action_runner.py index 7dbea972..714e7297 100644 --- a/pr_agent/servers/github_action_runner.py +++ b/pr_agent/servers/github_action_runner.py @@ -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', None) + if auto_review is None or (isinstance(auto_review, str) and auto_review.lower() == 'true'): + await PRReviewer(pr_url).run() + auto_describe = os.environ.get('github_action.auto_describe', None) + if isinstance(auto_describe, str) and auto_describe.lower() == 'true': + await PRDescription(pr_url).run() + auto_improve = os.environ.get('github_action.auto_improve', None) + if isinstance(auto_improve, str) and auto_improve.lower() == 'true': + await PRCodeSuggestions(pr_url).run() # Handle issue comment event elif GITHUB_EVENT_NAME == "issue_comment": diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index a272e1f9..aa28564c 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -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.yaml +# 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]"