A simple tool which creates a new Merge Request in the GitLab from the current branch.
It sets you, as an 'assignee' and your team as 'reviewers'.
create-mr --title 'I am a title' --draft true
- title - the title of the Merge Request
- description - the description of the Merge Request (default: Merge Request template, if it is configured)
- draft - is the Merge Request should be a Draft (default: true)
- GitLab
- NodeJS (I am using asdf as a version manager)
- Gitlab Personal Access Token with API access (https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
- Merge Request approval rule configured on the GitLab project (https://docs.gitlab.com/ee/user/project/merge_requests/approvals/rules.html)
-
Create a copy of the
config.json
and fill the gapscp config.example.json config.json
Example:
{ "gitlabBaseURL": "https://gitlab.com/api", "personalAccessToken": "1234567890", "approvalRuleName": [ "Team Sunrisers" ], "targetBranch": "develop" }
-
Install dependencies
npm install
-
Compile the project
npm run build
-
Add an alias in you
.bashrc
/.zshrc
to the scriptecho "alias create-mr=\"node $(pwd)/build/src/index.js\"" >> ~/.bashrc
or
echo "alias create-mr=\"node $(pwd)/build/src/index.js\"" >> ~/.zshrc
-
Apply the changes to the current terminal session
source ~/.bashrc
or
source ~/.zshrc