diff --git a/INSTALL.md b/INSTALL.md index 78331ee4..5f873355 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -156,7 +156,7 @@ The GITHUB_TOKEN secret is automatically created by GitHub. 3. Merge this change to your main branch. When you open your next PR, you should see a comment from `github-actions` bot with a review of your PR, and instructions on how to use the rest of the tools. -4. You may configure PR-Agent by adding environment variables under the env section corresponding to any configurable property in the [configuration](./Usage.md) file. Some examples: +4. You may configure PR-Agent by adding environment variables under the env section corresponding to any configurable property in the [configuration]((pr_agent/settings/configuration.toml)) file. Some examples: ```yaml env: # ... previous environment values diff --git a/Usage.md b/Usage.md index bc2544b8..7f6fcb9b 100644 --- a/Usage.md +++ b/Usage.md @@ -142,7 +142,21 @@ user=""" Note that the new prompt will need to generate an output compatible with the relevant [post-process function](./pr_agent/tools/pr_description.py#L137). ### Working with GitHub Action -TBD +You can configure settings in GitHub action by adding environment variables under the env section in `.github/workflows/pr_agent.yml` file. Some examples: +```yaml + env: + # ... previous environment values + OPENAI.ORG: "" + PR_REVIEWER.REQUIRE_TESTS_REVIEW: "false" # Disable tests review + PR_CODE_SUGGESTIONS.NUM_CODE_SUGGESTIONS: 6 # Increase number of code suggestions + github_action.auto_review: "true" # Enable auto review + github_action.auto_describe: "true" # Enable auto describe + github_action.auto_improve: "false" # Disable auto improve +``` +specifically, `github_action.auto_review`, `github_action.auto_describe` and `github_action.auto_improve` are used to enable/disable automatic tools that run when a new PR is opened. + +if not set, the default option is that only the `review` tool will run automatically when a new PR is opened. + ### Appendix - additional configurations walkthrough diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index 39a58144..e5f62eb3 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -239,9 +239,10 @@ class GithubProvider(GitProvider): def get_user_id(self): if not self.github_user_id: try: - self.github_user_id = self.github_client.get_user().login + self.github_user_id = self.github_client.get_user().raw_data['login'] except Exception as e: - logging.exception(f"Failed to get user id, error: {e}") + self.github_user_id = "" + # logging.exception(f"Failed to get user id, error: {e}") return self.github_user_id def get_notifications(self, since: datetime): diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 4ba27dd8..7f0b1264 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -22,7 +22,10 @@ class PRCodeSuggestions: ) # extended mode - self.is_extended = any(["extended" in arg for arg in args]) + try: + self.is_extended = any(["extended" in arg for arg in args]) + except: + self.is_extended = False if self.is_extended: num_code_suggestions = get_settings().pr_code_suggestions.num_code_suggestions_per_chunk else: