Created
March 30, 2023 21:52
-
-
Save joshjohanning/2537ebe8dad6875a9c33b4f24b35b2e7 to your computer and use it in GitHub Desktop.
create gitlab merge requests via the api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GITLAB_URL="https://example.gitlab.com/" | |
PROJECT_ID="2" # get this id via the repo/project's overview page | |
ACCESS_TOKEN="glpat-abc" | |
# Create a new merge request | |
curl --header "Private-Token: $ACCESS_TOKEN" \ | |
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/merge_requests" \ | |
--data "source_branch=my-branch" \ | |
--data "target_branch=main" \ | |
--data "title=My new merge request" #--data "description=this is a description" | |
# description will be `null` - which is what I was testing | |
# see also: https://docs.gitlab.com/ee/api/merge_requests.html#create-mr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! Short and useful!