This script is meant to be used in GitLab CI to automatically open Merge Requests for feature branches, if there is none yet.
The script is provided as dedicated docker image to improve maintainability in the future.
It is based on the script and idea of Riccardo Padovani, which he introduced with his blog post How to automatically create new MR on Gitlab with Gitlab CI. Thanks for providing this.
feature/ or fix/ will target the project's default branch in merge request.release will target the master branch.GITLAB_PRIVATE_TOKENSet a secret variable in your GitLab project with your private token.
Name it GITLAB_PRIVATE_TOKEN.
This is necessary to raise the Merge Request on your behalf.
.gitlab-ci.ymlAdd the following to your .gitlab-ci.yml file:
stages:
- openMr
- otherStages
Open Merge Request:
image: boy51/gitlab-auto-merge-request:stable
before_script: [] # We do not need any setup work, let's remove the global one (if any)
variables:
GIT_STRATEGY: none # We do not need a clone of the GIT repository to create a Merge Request
stage: openMr
only:
- /^feature\/*/
- /^fix\/*/
- /^hotfix\/*/
- /^release\/*/
script:
- merge-request.sh # The name of the script
You can see this in action at .gitlab-ci.yml of this project.
You can run the script merge-request-post-deploy.sh in a similar fashion. This script is meant to run on your master branch to create a merge request from master targeting develop.
The images are hosted on Docker Hub.
Two tags are noteworthy:
latest: Latest release on master branch of this project1: Latest stable release of 1.x version (see note on Semantic Versioning below)The GitHub project is only a mirror of the GitLab project.
Please open Issues and Merge Requests at the GitLab project.
This project follows Semantic Versioning. Following are defined as APIs according to the spec:
.gitlab-ci.ymlFollowing are not considered as API according to the spec:
Dockerfile and base image usedContent type
Image
Digest
Size
4.3 MB
Last updated
over 5 years ago
docker pull boy51/gitlab-auto-merge-request