{"id":27650290,"url":"https://github.com/pepakriz/gitlab-merger-bot","last_synced_at":"2025-04-24T03:34:19.096Z","repository":{"id":38262103,"uuid":"155676464","full_name":"pepakriz/gitlab-merger-bot","owner":"pepakriz","description":"GitLab Merger Bot","archived":false,"fork":false,"pushed_at":"2025-03-28T22:22:36.000Z","size":2703,"stargazers_count":59,"open_issues_count":8,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-16T09:27:07.713Z","etag":null,"topics":["bot","gitlab","merge","merge-request","pipeline","pull-request"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pepakriz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-01T07:13:53.000Z","updated_at":"2025-01-20T15:17:09.000Z","dependencies_parsed_at":"2024-02-14T13:43:30.049Z","dependency_job_id":"58f1f888-594f-4e0e-a059-76f251351c17","html_url":"https://github.com/pepakriz/gitlab-merger-bot","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepakriz%2Fgitlab-merger-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepakriz%2Fgitlab-merger-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepakriz%2Fgitlab-merger-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepakriz%2Fgitlab-merger-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pepakriz","download_url":"https://codeload.github.com/pepakriz/gitlab-merger-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250557640,"owners_count":21450163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","gitlab","merge","merge-request","pipeline","pull-request"],"created_at":"2025-04-24T03:34:18.512Z","updated_at":"2025-04-24T03:34:19.081Z","avatar_url":"https://github.com/pepakriz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitLab merger bot\n\n![Build Status](https://github.com/pepakriz/gitlab-merger-bot/actions/workflows/release.yml/badge.svg)\n\n## What does it do?\n\nThe goal is to have green master after every merge. To achieve this, you have to rebase every single merge request just before a merge and wait for the pipeline status. It takes a lot of time to manually maintain, especially when you have to process multiple merge requests at once (common situation for large projects, monorepos etc.). So let's automate it with GitLab MergerBot.\n\n1) When your merge request is ready to be merged, assign it to the bot.\n2) The bot will add your request to its own serial (FIFO) queue. (single queue for every repository)\n3) When your request is on the turn, the bot will rebase the MR and start waiting for the pipeline.\n4) When the bot detects some problems with the merge request it'll reassign the merge request back to the author.\u003cbr /\u003e\nReasons can be for example:\n\t- Failing pipeline or pipeline waiting for a manual action\n\t- The merge request has unresolved discussions\n\t- The merge request can't be rebased due to a conflict\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"docs/merged.png\" alt=\"Merged\" /\u003e\n\t\u003cimg src=\"docs/assign.png\" alt=\"Assign\" /\u003e\n\t\u003cimg src=\"docs/queue.png\" alt=\"Queue\" width=\"546\" height=\"auto\" /\u003e\n\u003c/p\u003e\n\n### Advanced features\n\n- Autogenerated commit message based on MR title (Suffixed with a link to the original MR).\n- Blocking jobs are triggered automatically. Very useful for E2E testing etc.\n- Bot skips squashing when the `bot:skip-squash` label is present on a MR.\n- Bot assigns a MR to the start of the queue when the `bot:high-priority` label is present. This is useful for hotfixes etc.\n\n## Pre-Installation requirements\n\n#### Get the auth token\n\n1) Create a new account for your bot-user\n2) Sign-in to GitLab as the bot-user and go to [https://gitlab.com/profile/personal_access_tokens](https://gitlab.com/profile/personal_access_tokens)\n3) Add new personal access token with the `api` scope\n\n\u003e We strongly recommend using a separate account for the bot-user. Don't reuse an existing account that can leave the project in the future.\n\n#### Setup a GitLab repository\n\n1) Make sure that your bot-user has privileges to accept merge requests\n2) In the `General Settings - Merge Request` section:\n\t* set `Merge method` to `Fast-forward merge`\n\t* check `Only allow merge requests to be merged if the pipeline succeeds`\n\t* check (optionally) `All discussions must be resolved`\n\n\n## Usage\n\n#### Running in kubernetes (with HELM)\n\nTo add the Helm Chart for your local client, run helm repo add:\n\n```bash\nhelm repo add gitlab-merger-bot https://pepakriz.github.io/gitlab-merger-bot\n```\n\nAnd install it:\n\n```bash\nhelm install --name gitlab-merger-bot gitlab-merger-bot \\\n#\t--set settings.gitlabUrl=\"https://gitlab.mycompany.com\" \\\n\t--set settings.authToken=\"\u003ctoken\u003e\"\n```\n\n#### Running in docker\n\n```bash\ndocker run -d --name gitlab-merger-bot --restart on-failure \\\n#\t-e GITLAB_URL=\"https://gitlab.mycompany.com\" \\\n\t-e GITLAB_AUTH_TOKEN=\"\u003ctoken\u003e\" \\\n\t-v \"$(pwd)/data\":/data \\\n\tpepakriz/gitlab-merger-bot:latest\n```\n\n#### Running as a plain JS app\n\n```bash\nyarn install\nyarn run build\nGITLAB_AUTH_TOKEN=\"\u003ctoken\u003e\" yarn run start\n```\n\n#### Configuration options\n\n| Env variable                   | Default value        |                                                                            |\n|--------------------------------|----------------------|----------------------------------------------------------------------------|\n| `GITLAB_URL`                   | `https://gitlab.com` | GitLab instance URL                                                        |\n| `GITLAB_AUTH_TOKEN`            |                      | `required` Your GitLab token                                               |\n| `ALLOWED_PROJECT_IDS`          | ``                   | It'll restrict operation only on selected projects. (comma separated list) |\n| `HTTP_PROXY`                   | ``                   | Use HTTP proxy for API communication                                       |\n| `CI_CHECK_INTERVAL`            | `10`                 | Time between CI checks (in seconds)                                        |\n| `MR_CHECK_INTERVAL`            | `20`                 | Time between merge-requests checks (in seconds)                            |\n| `REMOVE_BRANCH_AFTER_MERGE`    | `true`               | It'll remove branch after merge                                            |\n| `SQUASH_MERGE_REQUEST`         | `true`               | It'll squash commits on merge                                              |\n| `PREFER_GITLAB_TEMPLATE`       | `false`              | Use Gitlab template instead of custom message                              |\n| `AUTORUN_MANUAL_BLOCKING_JOBS` | `true`               | It'll autorun manual blocking jobs before merge                            |\n| `SKIP_SQUASHING_LABEL`         | `bot:skip-squash`    | It'll skip squash when MR contains this label                              |\n| `HIGH_PRIORITY_LABEL`          | `bot:high-priority`  | It'll put MR with this label to the beginning of the queue                 |\n| `SENTRY_DSN`                   | ``                   | It'll enable Sentry monitoring                                             |\n| `HTTP_SERVER_ENABLE`           | `false`              | It'll enable experimental API and dashboard support                        |\n| `HTTP_SERVER_PORT`             | `4000`               | It'll use different http server port                                       |\n| `WEB_HOOK_TOKEN`               | ``                   | It'll enable experimental web hook support                                 |\n| `WEB_HOOK_HISTORY_SIZE`        | `100`                | It's useful just primarily for debugging purposes.                         |\n| `ENABLE_PERMISSION_VALIDATION` | `false`              | It'll enable experimental permission validation                            |\n\n## Development\n\nFor web hook development use this:\n\n```bash\nexport NGROK_AUTHTOKEN=\u003cauthCode\u003e\ndocker run -it --rm --net=host -p 4040:4040 -e NGROK_AUTHTOKEN=\"$NGROK_AUTHTOKEN\" wernight/ngrok ngrok http 4000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepakriz%2Fgitlab-merger-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpepakriz%2Fgitlab-merger-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepakriz%2Fgitlab-merger-bot/lists"}