Want to create issue and merge request through git bash and not using GitLab UI. if it is possible ? Please help me with the commands in git bash to do so.
GROUP="your_project_group_name"
REPOSITORY="your_project_name"
GITLAB_BASE_URL="http://gitlab.base.url"
GITLAB_PERSONAL_ACCESS_TOKEN="your_token_here"
GITLAB_API="api/v4"
CLIENT_PROJECT="${GROUP}%2F${REPOSITORY}"
URL_CREATE_MERGE_REQUEST="$GITLAB_BASE_URL/$GITLAB_API/projects/$CLIENT_PROJECT/merge_requests"
create_merge_request ()
{
local source_branch=$1
local target_branch=$2
output=$(curl -X POST -d "{
\"id\": \"$CLIENT_PROJECT\",
\"source_branch\": \"$source_branch\",
\"target_branch\": \"$target_branch\",
\"title\": \"AutoGeneratedMR\",
\"description\": \"Test\",
\"should_remove_source_branch\": false,
\"force_remove_source_branch\": false
}" -H "Private-Token: $GITLAB_PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" --url "${URL_CREATE_MERGE_REQUEST}" )
echo $output;
}
create_merge_request "feature-1" "master"
Read api for other actions https://docs.gitlab.com/ce/api/README.html