Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open an issue and create a MR out of that issue #153

Open
nvgoldin opened this issue May 17, 2018 · 11 comments
Open

Open an issue and create a MR out of that issue #153

nvgoldin opened this issue May 17, 2018 · 11 comments

Comments

@nvgoldin
Copy link

Hi,
I use this GitLab flow a lot:

  1. Create an issue
  2. Click "create merge request" button from the issue, so that GitLab creates the branch and names it according to the issue.

Is it possible to do both these operations with Lab?

@zaquestion
Copy link
Owner

@nvgoldin We don't have anything specifically support that workflow right now. I'm not familiar with the functionality in GitLab so I'll have to try it out before I could comment on how to support it here. In the meantime ideas on workflow you'd use within lab would be very welcome. Such as what commands you'd like to execute.

Off the cuff,

lab issue create
.... something here?
lab mr create

@jspreddy
Copy link

It seems like it is a specific workflow. Is this workflow considerably widespread? If so, what is it called?
If not, then seems like you can chain the following generic commands. i.e. if these commands/functionality exists.

You may have to create a merge request and link the MR to the Issue using the edit issue: PUT /projects/:id/issues/:issue_iid
https://docs.gitlab.com/ee/api/issues.html#edit-issue

$ lab issue create --show=id
*opens an editor for you to enter the issue details*
535


$ lab create mr --show=id
*opens an editor for you to enter mr details*
989

$ lab issue edit --mr_id=989 535

thoughts?

@zaquestion
Copy link
Owner

Had a chance to try out the "create merge request" on issue feature and it look like it indeed creates a new branch named after the issue and also creates a WIP merge request to be pushed to. With that in mind I'm thinking a couple changes

lab issue create --mr # for creating WIP mr in the same swing as creating an issue
lab issue create mr <issue_id> # for create a WIP mr off an an issue

Part of me worries about the implications of creating empty merge requests that may or may not have changes ready to be pushed... but I'm willing to make these changes. Not sure when I will have the change to get to them however. There are some other requests/issues I'd like to tackle first, and I'm currently swamped at work so I haven't been able to get in any coding here in the last couple weeks.

@zaquestion
Copy link
Owner

@nvgoldin How would the above work for you?

@nvgoldin
Copy link
Author

nvgoldin commented Jul 3, 2018

@zaquestion,

lab issue create --mr # for creating WIP mr in the same swing as creating an issue
lab issue create mr <issue_id> # for create a WIP mr off an an issue

The above two would do exactly what I need!

I am surprised this flow is not common actually, I thought that is the 'standard' way of doing things in GitLab. After using it for nearly a year I can't even think of a branch name which does not equal to the issue name.

@nvgoldin
Copy link
Author

any news here?

@matrixise
Copy link

any news about this issue, thank you

@prarit
Copy link
Collaborator

prarit commented Sep 23, 2021

I think this died on the vine so to speak. Re-reading back through this you want to do

lab issue create --mr # for creating WIP mr in the same swing as creating an issue
lab issue create mr <issue_id> # for create a WIP mr off an an issue

I'll look into it.

@prarit
Copy link
Collaborator

prarit commented Sep 27, 2021

@matrixise , I took a look at implementing this. I've always created a branch, pushed the branch, and then created an MR on that branch (via lab and the GitLab webUI). I have a public test project [1] where I've created an issue [2] but do not see a "Create a Merge Request" option. Is there something obvious I'm missing?

I do see that GitLab Quick Actions [3] support the creation of an MR from an issue, but only for a previously created branch

ie) /create_merge_request

I have a feeling there is something I'm missing OR perhaps some functionality changed on GitLab.

[1] https://gitlab.com/prarit/Test-Lab
[2] https://gitlab.com/prarit/Test-Lab/-/issues/1
[3] https://docs.gitlab.com/ee/user/project/quick_actions.html

@prarit
Copy link
Collaborator

prarit commented Sep 28, 2021

@bmeneguele @zampierilucas I suppose we could do this one with quick actions as well? What do you two think?

@zampierilucas
Copy link
Collaborator

@prarit The criteria for the create_merge_request_button and /create_merge_requuest working is[1]:

The Create merge request button doesn’t display if:

  • A branch with the same name already exists.
  • A merge request already exists for this branch.
  • Your project has an active fork relationship.

Which we could use the quick actions to tackle, but I haven't found any API return that confirms if the criteria listed above has met.
One other thing that we could do is, create a Mr that contains a message with "Fixes: Issue123" which links the Mr and the issue. That is if we cannot use the gitlab build-in methods.

[1] https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-new-branch-from-an-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants