github action now also uses .pr_agent.toml

This commit is contained in:
mrT23
2023-10-28 13:34:32 +03:00
parent 4dffabf397
commit 638db96311
3 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.git_providers.utils import apply_repo_settings
from pr_agent.log import get_logger
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
@ -57,6 +59,15 @@ async def run_action():
# Handle pull request event
if GITHUB_EVENT_NAME == "pull_request":
action = event_payload.get("action")
try:
get_logger().info("Applying repo settings")
pr_url = event_payload.get("pull_request", {}).get("html_url")
if pr_url:
apply_repo_settings(pr_url)
except Exception as e:
get_logger().info(f"github action: failed to apply repo settings: {e}")
if action in ["opened", "reopened"]:
pr_url = event_payload.get("pull_request", {}).get("url")
if pr_url: