An open API service indexing awesome lists of open source software.

https://github.com/xmoelletschi/renoglaab

Renovate GitLab auto-approve Bot
https://github.com/xmoelletschi/renoglaab

gitlab golang renovate renovate-approve-bot

Last synced: 2 months ago
JSON representation

Renovate GitLab auto-approve Bot

Awesome Lists containing this project

README

        

# renoglaab

`renoglaab` is a Go application designed to run in a GitLab CI job and automatically merge Renovate merge requests based on predefined conditions.

## Features

- Configurable filtering by author, labels, branch regex, and pipeline status.
- Adds comments to merge requests upon approval.
- Automatically approves Renovate merge requests.

## Prerequisites

- Renovate configured to create MRs.
- GitLab Personal Access Token (PAT) or Group Access Token with `api` scope.

## Configuration

Modify environment variables to configure merging behavior:

| Variable | Description | Default | Options |
|---------------------------------------|--------------------------------------------------|-----------------------------------|-----------------------------------|
| `EXTRACT_FROM_FILE` | Read repositories from file | `false` | `true`, `false` |
| `CONFIG_PATH` | Path to the configuration file | `$CI_PROJECT_DIR/config.js` | Any valid file path |
| `LOG_LEVEL` | Logging level (`debug`, `info`, `warn`, `error`) | `info` | `debug`, `info`, `warn`, `error` |
| `GITLAB_API_TOKEN` | GitLab API token (required) | | Any valid token |
| `GITLAB_URL` | GitLab instance URL | `https://gitlab.com` | Any valid URL |
| `FILTER_BY_AUTHOR_USERNAME` | Filter MRs by author username | `true` | `true`, `false` |
| `AUTHOR_USERNAME` | Author username to filter MRs | `renovate-bot` | Any valid username |
| `FILTER_BY_LABELS` | Filter MRs by labels | `true` | `true`, `false` |
| `LABELS` | Labels to filter MRs | `renovate` | Any valid label |
| `FILTER_BY_BRANCH` | Filter MRs by branch regex | `true` | `true`, `false` |
| `ALLOWED_BRANCH_REGEX` | Regex for allowed branches | `renovate/automerge` | Any valid regex |
| `FILTER_BY_SUCCEEDED_PIPELINE` | Filter MRs by succeeded pipeline | `true` | `true`, `false` |
| `FILTER_BY_PIPELINE_WITHOUT_WARNINGS` | Filter MRs by pipeline without warnings | `true` | `true`, `false` |
| `ADD_COMMENT` | Add a comment to the MR | `true` | `true`, `false` |
| `COMMENT` | Comment to add to the MR | `Approving merge request! :ship:` | Any valid comment |
| `APPROVE` | Approval command | `/approve` | Any valid command |

## Usage

Add the following job to your `.gitlab-ci.yml`:
```yml
renoglaab:
image: ghcr.io/xmoelletschi/renoglaab:latest
script:
- /renoglaab
```
To run this job in a scheduled pipeline, add a schedule to your GitLab project under **CI / CD > Schedules**.

By default, `renoglaab` reads the directories from the `RENOVATE_EXTRA_FLAGS` variable. If you are using a `config.js` file to define where Renovate should run, then please set `EXTRACT_FROM_FILE` to `true`.

## Examples

For a real-world example, visit the [renoglaab GitLab group](https://gitlab.com/renoglaab). [currently in WIP]

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## Support

For support or questions, open a discussion on the [GitHub repository](https://github.com/xMoelletschi/renoglaab/discussions).

## License

This project is licensed under the [MIT License](LICENSE).