diff --git a/pr_agent/servers/github_action_runner.py b/pr_agent/servers/github_action_runner.py index 7dbea972..d1a0f119 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') + 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": diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index a272e1f9..4f71827c 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.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]"