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

lab issue create mr #844

Open
dooraim opened this issue Nov 2, 2022 · 4 comments · May be fixed by #871
Open

lab issue create mr #844

dooraim opened this issue Nov 2, 2022 · 4 comments · May be fixed by #871

Comments

@dooraim
Copy link

dooraim commented Nov 2, 2022

Hi, I saw that when you create an Issue it is not possible to create an MR, which instead you can do through Gitlab's web interface, as shown in the image below. Is this features still not yet available or will it not be implemented?

immagine

@prarit
Copy link
Collaborator

prarit commented Jul 13, 2023

Sorry for the very late reply. I am going through some old issues and seeing what can be done to resolve them.

@zampierilucas , I don't see anything obvious with the Merge Request or Issue APIs that allows this sort of linking, even though there are references to being able to do so. Any idea on where I might find the API magic?

@zampierilucas
Copy link
Collaborator

@prarit The feature @dooraim is looking for is creating_merge_requests.html#from-an-issue, and from those docs "selecting Create merge request redirects to the merge request creation form instead of immediately creating the merge request.", so there's no API to directly do that.

But what GitLab does in the backend is quite simple, it does two things:

  • Adds "Closes $ISSUE_ID" to the mr description, that's creates a reference between the mr to an issue, so when the mr is merged, the issue is also resolved.
  • Created a branch and pushed it based on the issue title, example this issue is named "Consider building this in COPR":
    image

So the resulting mr is an empty(no commits) mr like:
image

This can probably be scripted using pipes in lab, but we can also implement it, wdyt?

@prarit
Copy link
Collaborator

prarit commented Jul 14, 2023

Interesting thought. But I wonder if it is easier just to append the Description with a 'Closes' line?

@zampierilucas
Copy link
Collaborator

Sure, GitLab will see as the same as using the button on the issue, we would only be missing the convenience of having a branch name and description based on the issue data, unless manually created.

@prarit prarit linked a pull request Jul 14, 2023 that will close this 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

Successfully merging a pull request may close this issue.

3 participants