Update GitLab configuration and documentation for webhook setup

This commit is contained in:
mrT23
2024-02-21 09:20:28 +02:00
parent 0e3417b4ab
commit 275f0d6a05
3 changed files with 18 additions and 12 deletions

View File

@ -6,6 +6,7 @@
- [Online Usage](#online-usage)
- [GitHub App](#working-with-github-app)
- [GitHub Action](#working-with-github-action)
- [GitLab Webhook](#working-with-gitlab-webhook)
- [BitBucket App](#working-with-bitbucket-self-hosted-app)
- [Azure DevOps Provider](#azure-devops-provider)
- [Additional Configurations Walkthrough](#appendix---additional-configurations-walkthrough)
@ -237,6 +238,16 @@ For example, you can set an environment variable: `pr_description.add_original_u
[pr_description]
add_original_user_description = false
```
### Working with GitLab Webhook
After setting up a GitLab webhook, to control which commands will run automatically when a new PR is opened, you can set the `pr_commands` parameter in the configuration file, similar to the GitHub App:
```
[gitlab]
pr_commands = [
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
"/review --pr_reviewer.num_code_suggestions=0",
"/improve",
]
```
### Working with BitBucket Self-Hosted App
Similar to GitHub app, when running PR-Agent from BitBucket App, the default [configuration file](pr_agent/settings/configuration.toml) from a pre-built docker will be initially loaded.

View File

@ -32,7 +32,7 @@ def handle_request(background_tasks: BackgroundTasks, url: str, body: str, log_c
async def _perform_commands_gitlab(commands_conf: str, agent: PRAgent, body: dict, api_url: str, log_context: dict):
apply_repo_settings(api_url)
commands = get_settings().get(f"azure_devops_server.{commands_conf}")
commands = get_settings().get(f"gitlab.{commands_conf}")
for command in commands:
split_command = command.split(" ")
command = split_command[0]

View File

@ -171,17 +171,12 @@ push_commands = [
]
[gitlab]
# URL to the gitlab service
url = "https://gitlab.com"
# Polling (either project id or namespace/project_name) syntax can be used
projects_to_monitor = ['org_name/repo_name']
# Polling trigger
magic_word = "AutoReview"
# Polling interval
polling_interval_seconds = 30
url = "https://gitlab.com" # URL to the gitlab service
pr_commands = [
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
"/review --pr_reviewer.num_code_suggestions=0",
"/improve --pr_code_suggestions.summarize=true",
]
[bitbucket_app]
#auto_review = true # set as config var in .pr_agent.toml