diff --git a/docs/GENERATE_CUSTOM_LABELS.md b/docs/GENERATE_CUSTOM_LABELS.md index 5c1743f4..25876fe0 100644 --- a/docs/GENERATE_CUSTOM_LABELS.md +++ b/docs/GENERATE_CUSTOM_LABELS.md @@ -3,7 +3,7 @@ The `generte_labels` tool scans the PR code changes, and given a list of labels It can be invoked manually by commenting on any PR: ``` -/generte_labels +/generate_labels ``` For example: diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index 7a47fbf5..494f2df7 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -258,9 +258,10 @@ class GithubProvider(GitProvider): def get_repo_settings(self): try: - contents = self.repo_obj.get_contents(".pr_agent.toml", ref=self.pr.head.sha).decoded_content + contents = self.repo_obj.get_contents(".pr_agent.toml").decoded_content return contents - except Exception: + except Exception as e: + # get_logger().exception(f"Failed to get repo settings, error: {e}") return "" def add_eyes_reaction(self, issue_comment_id: int) -> Optional[int]: diff --git a/pr_agent/settings/custom_labels.toml b/pr_agent/settings/custom_labels.toml index 8b1340f2..43e14b0e 100644 --- a/pr_agent/settings/custom_labels.toml +++ b/pr_agent/settings/custom_labels.toml @@ -1,16 +1,18 @@ +[config] enable_custom_labels=false -[custom_labels."Bug fix"] -description = "Fixes a bug in the code" -[custom_labels."Tests"] -description = "Adds or modifies tests" -[custom_labels."Bug fix with tests"] -description = "Fixes a bug in the code and adds or modifies tests" -[custom_labels."Refactoring"] -description = "Code refactoring without changing functionality" -[custom_labels."Enhancement"] -description = "Adds new features or functionality" -[custom_labels."Documentation"] -description = "Adds or modifies documentation" -[custom_labels."Other"] -description = "Other changes that do not fit in any of the above categories" \ No newline at end of file +## template for custom labels +#[custom_labels."Bug fix"] +#description = "Fixes a bug in the code" +#[custom_labels."Tests"] +#description = "Adds or modifies tests" +#[custom_labels."Bug fix with tests"] +#description = "Fixes a bug in the code and adds or modifies tests" +#[custom_labels."Refactoring"] +#description = "Code refactoring without changing functionality" +#[custom_labels."Enhancement"] +#description = "Adds new features or functionality" +#[custom_labels."Documentation"] +#description = "Adds or modifies documentation" +#[custom_labels."Other"] +#description = "Other changes that do not fit in any of the above categories" \ No newline at end of file diff --git a/pr_agent/tools/pr_generate_labels.py b/pr_agent/tools/pr_generate_labels.py index bf5b5f98..3fcccda0 100644 --- a/pr_agent/tools/pr_generate_labels.py +++ b/pr_agent/tools/pr_generate_labels.py @@ -45,7 +45,7 @@ class PRGenerateLabels: "commit_messages_str": self.git_provider.get_commit_messages(), "custom_labels": "", "custom_labels_examples": "", - "enable_custom_labels": get_settings().enable_custom_labels, + "enable_custom_labels": get_settings().config.enable_custom_labels, } # Initialize the token handler diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 0eeb5578..78669d1a 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -64,7 +64,7 @@ class PRReviewer: "extra_instructions": get_settings().pr_reviewer.extra_instructions, "commit_messages_str": self.git_provider.get_commit_messages(), "custom_labels": "", - "enable_custom_labels": get_settings().enable_custom_labels, + "enable_custom_labels": get_settings().config.enable_custom_labels, } self.token_handler = TokenHandler(