Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

The benefits of auto-merging GitHub and GitLab repositories

July 3, 2025
Petr Hracek
Related topics:
Automation and managementCI/CDContainersDeveloper productivityDeveloper toolsLinux
Related products:
Red Hat Developer HubRed Hat Enterprise Linux

    This article is for developers who want to see what is missing in their GitHub pull requests or GitLab merge requests. We will explain the advantage of automatically merging GitHub pull requests when meeting the conditions and provide information about the status mail about pull requests in specific GitHub repositories.

    Read the previous article for inspiration, Testing Farm as GitHub Action: User stories.

    Prerequisites

    Auto-merger relies on labels marking PRs with missing CI and/or reviews. You can use auto-merge-wrapper GitHub Action to set these labels automatically. Follow the instructions described in the README documentation. As an example, you can refer to our postgresql-container, where the auto-merge-wrapper is on-boarded.

    The GitHub Action will regularly check opened PRs and set labels based on their state. Additionally, it will create comments on PR with status. The validation in Figure 1 shows the status of the pull request.

    The picture in Figure 1 shows the status of validation and tests results
    Figure 1: The validation shows the status of the pull request. 

    The auto-merge-wrapper GitHub Action is a composite action that uses pull-request-validator and auto-merge GitHub Actions in the background. These actions can be additionally configured to ignore specific CI jobs, adjust the number of reviewers, or interact with Bugzilla bugs and Jira issues. For more information, follow the documentation from the README.

    To check GitHub repositories, you must generate an API token, as described in GitHub. Before running the auto-merger github-checker tool, run the following command:

    $ export GH_TOKEN=<your token>

    To check GitLab repositories, generate the API token, as described in this GitLab. Before running the auto-merger gitlab-checker tool, run this command:

    $ export GITLAB_TOKEN=<your token> 

    Installing and configuring auto-merger

    First, you need to install auto-merger by command.

    $ pip3 install git+https://github.com/sclorg/auto-merger.git

    Auto-merger must have a configuration file placed in the $HOME directory with the name ".auto-merger.yaml".

    The configuration file for GitHub looks like this:

    github:
    namespace: "sclorg"
    repos:
       - s2i-ruby-container
       - s2i-perl-container
       - s2i-nodejs-container
    # How many approvals should have PR - default is 2
    approvals: 1
    # How many days, PR should be opened - default is 1 day
    pr_lifetime: 1
    # Labels that blocks merges
    blocker_labels:
       - "pr/failing-ci"
       - "pr/missing-review"
    # Labels that should be present in pull request before merging
    approval_labels:
       - "READY-to-MERGE"

    The configuration file for GitLab looks like this:

    gitlab:
    namespace: “redhat/rhel/containers”
    repos:
    - postgresql-16
    - mysql-84
    - python-312-minimal
    approvals: 1
    # How many days, PR should be opened - default is 1 day
    pr_lifetime: 1
    # Labels that blocks merges
    blocker_labels:
    - "ci-failing"
    - "review-missing"
    # Labels that should be present in pull request before merging
    approval_labels:
    - "READY-to-MERGE"

    Both configurations merge into one file. 

    The fields in the GitHub or GitLab sections are defined as follows:

    • namespace - The namespace in GitHub where repositories mentioned.
    • repos - The repositories we will check.
    • approvals - The number of approvals needed to allow automatic merging.
    • pr_lifetime - Specify the lifetime during which each pull request should be opened.
    • blocker_labels - Specify the blocker labels that block auto-merging each pull request.
    • approval_labels - Specify the approval labels that should be present in each pull request 

    Now that auto-merger has set all the information, let’s see what auto-merger can do.

    How to receive GitHub pull requests status

    Let’s gather all the information about the GitHub repositories mentioned in the configuration file, using the following command:

    $ auto-merge github-checker

    If you would like to receive information about what’s going on, add –send-email to the previous command with your email address.

    The output may look like this:

    $ auto-merge github-checker
    
    Pull requests that are blocked by labels [pr/failing-ci, pr/missing-review]
    
    Let's check repository in sclorg/s2i-ruby-container
    
    Add PR'579' of 's2i-ruby-container' to blocked PRs.
    
    Add PR'575' of 's2i-ruby-container' to blocked PRs.
    
    Add PR'570' of 's2i-ruby-container' to blocked PRs.
    
    Let's check repository in sclorg/s2i-perl-container
    
    Add PR'331' of 's2i-perl-container' to blocked PRs.
    
    Let's check repository in sclorg/s2i-nodejs-container
    
    Add PR'477' of 's2i-nodejs-container' to blocked PRs.
    
    Add PR'476' of 's2i-nodejs-container' to blocked PRs.
    
    
    
    SUMMARY OF BLOCKED PULL REQUESTS
    
    Pull requests that are blocked by labels [pr/failing-ci, pr/missing-review]
    
    s2i-ruby-container
    
    https://github.com/sclorg/s2i-ruby-container/pull/579 pr/missing-review
    
    https://github.com/sclorg/s2i-ruby-container/pull/575 pr/missing-review pr/failing-ci
    
    https://github.com/sclorg/s2i-ruby-container/pull/570 pr/missing-review pr/failing-ci
    
    s2i-perl-container
    
    https://github.com/sclorg/s2i-perl-container/pull/331 pr/missing-review
    
    s2i-nodejs-container
    
    https://github.com/sclorg/s2i-nodejs-container/pull/477 pr/missing-review pr/failing-ci
    
    https://github.com/sclorg/s2i-nodejs-container/pull/476 pr/missing-review

    How to receive GitLab merge requests status

    Let’s gather all the information about the repositories mentioned in the GitLab configuration file, using the following command:

    $ auto-merge gitlab-checker

    If you would like to receive information, you can add –-send-email to the previous command with your email address.

    The output may look like this:

    $ auto-merge gitlab-checker
    
    Let's check repository in redhat/rhel/containers/postgresql-16
    
    - Checking PR 235 for redhat/rhel/containers/postgresql-16
    
    - Checking PR 234 for redhat/rhel/containers/postgresql-16
    
    - Checking PR 180 for redhat/rhel/containers/postgresql-16
    
    - Checking PR 178 for redhat/rhel/containers/postgresql-16
    
    Let's check repository in redhat/rhel/containers/mysql-84
    
    - Checking PR 72 for redhat/rhel/containers/mysql-84
    
    - Checking PR 71 for redhat/rhel/containers/mysql-84
    
    - Checking PR 68 for redhat/rhel/containers/mysql-84
    
    - Checking PR 67 for redhat/rhel/containers/mysql-84
    
    - Checking PR 31 for redhat/rhel/containers/mysql-84
    
    Let's check repository in redhat/rhel/containers/python-312-minimal
    
    - Checking PR 73 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 72 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 71 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 68 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 49 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 40 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 38 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 37 for redhat/rhel/containers/python-312-minimal
    
    - Checking PR 12 for redhat/rhel/containers/python-312-minimal
    
    
    
    SUMMARY
    
    GitLab merge requests that are blocked by labels [pr/failing-ci, pr/missing-review]
    
    redhat/rhel/containers/postgresql-16
    
    ------
    
    https://gitlab.com/redhat/rhel/containers/postgresql-16/-/merge_requests/235 'chore(deps): update konflux references'
    
    https://gitlab.com/redhat/rhel/containers/postgresql-16/-/merge_requests/234 'checking if tests run'
    
    https://gitlab.com/redhat/rhel/containers/postgresql-16/-/merge_requests/180 'chore(deps): update registry.stage.redhat.io/rhel9/s2i-core:9.6 docker digest to cd24a28'
    
    https://gitlab.com/redhat/rhel/containers/postgresql-16/-/merge_requests/178 'chore(deps): update registry.stage.redhat.io/rhel10/s2i-core:10.0 docker digest to 07d5729'
    
    
    
    redhat/rhel/containers/python-312-minimal
    
    ------
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/73 'Update registry.access.stage.redhat.com/ubi10/ubi-minimal:10.1 Docker digest to 26a30ce'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/72 'Konflux update python-312-minimal-10-0'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/71 'checking if tests run'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/68 'Use remote build pipeline'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/49 'RPM updates'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/40 'Update Konflux references'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/38 'RPM updates'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/37 'Update registry.stage.redhat.io/ubi9/ubi-minimal:9.6 Docker digest to db2f908'
    
    https://gitlab.com/redhat/rhel/containers/python-312-minimal/-/merge_requests/12 'Update sources based on the upstream'
    
    
    
    redhat/rhel/containers/mysql-84
    
    ------
    
    https://gitlab.com/redhat/rhel/containers/mysql-84/-/merge_requests/72 'Lzachar trying 9.7.0'
    
    https://gitlab.com/redhat/rhel/containers/mysql-84/-/merge_requests/71 'Konflux update mysql-84-9-6'
    
    https://gitlab.com/redhat/rhel/containers/mysql-84/-/merge_requests/68 'Update registry.access.stage.redhat.com/ubi10/s2i-core:10.1 Docker digest to 6d3cfdc'
    
    https://gitlab.com/redhat/rhel/containers/mysql-84/-/merge_requests/67 'Try newer task-prefetch-dependencies-oci-ta'
    
    https://gitlab.com/redhat/rhel/containers/mysql-84/-/merge_requests/31 'Update registry.stage.redhat.io/rhel9/s2i-core:9.6 Docker digest to cd24a28'

    When GitHub pull requests meet criteria

    What should you do in case pull requests meet all criteria? Let’s call auto-merger to enable automatic merging.

    In case a pull request meets following criteria:

    • The READY-to-MERGE labels are present.
    • The pull request has enough approvals.

    Then the auto-merger tool merges the pull request.

    Currently, if "pr/failing-ci" and "pr/missing-review" are present in the pull request, then the pull request is merged as well.

    Soon there will be a flag like "merge_even_blocker_labels" that will allow it or disable it.

    To enable auto-merging support, use this easy command: 

    $ auto-merger merger

    To receive information about the merged pull request, add –-send-email to the previous command with your email address.

    If nothing will be merged, you'll see a message like this:

    $ auto-merge merger
    SUMMARY
    There is nothing to merge.

    When there is something to be merged, you will see message like this:

    $ auto-merge merger
    https://github.com/sclorg/s2i-python-container/pull/731 -> CAN BE MERGED
    Let's try to merge 731....
    Pull request 731 was merged 

    Next steps

    You can run the auto-merger tool per user request or execute regularly on some host which is a long-time machine, such as a cronjob. The tool is on-boarded in our organization (e.g., details in the postgresql-container) and sent daily reports about pull requests. From now on, you can execute auto-merger daily, weekly, or even hourly. 

    You can also find out what's going on with your pull request or merge-request. In the end, if you see that something is ready to merge, then execute the auto-merger merger option to automatically merge your pull request or merge request. Do not waste your time browsing web pages. You can run this tool, and it will show you the results. 

    What are the next steps?

    • The option for exporting results to JSON or YAML will follow (i.e., usage for CI systems).

    • Allow disable merging in case of blocker_lables.

    • Improve all GitLab merge requests.

    Related Posts

    • Automate CI/CD on pull requests with Argo CD ApplicationSets

    • How to create a pull request: contributing to Open Source

    • Test pull requests with the Try in Web IDE GitHub action

    • Build container images in OpenShift using Podman as a GitLab runner

    Recent Posts

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    • Configure a split disk on OpenShift Container Platform

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    What’s up next?

    GitOps has become a standard in deploying applications to Kubernetes, and many companies are adopting the methodology for their DevOps and cloud-native strategy. Download the GitOps Cookbook for useful recipes and examples for successful hands-on applications development and deployment with GitOps.

    Get the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.