Branching From YouTrack

I have been working on a solution to create branches directly from an YouTrack issue.

I have been able to write an action that does this with my GitLab server, by using GitLab's APIs while only branching from main. What I'd like to be able to do is select a "Branch From?" in YouTrack then use that branch in order to automatically create the new branch in GitLab. This is where I am stuck.

I've thought of a couple options but not sure if I am capable to do them.

  1. Part of the Action gives users a list of available branches. This could be populated from an API request to GitLab or 
  2. Intercept the VCS changes coming from GitLab on my existing integration and create a list of branches as an EnumField

Not sure if anyone has tried anything similar, looking over the documentation I don't believe either of these are possible and wanted to reach out here.

0
7 comments
Official comment

Hi!

I'm Sergey from the YouTrack team.

We don't have a ready-to-use solution for such a case, yet I just wanted to suggest taking a look at the YouTrack workflow functionality in case you haven't yet. Specifically, there's an HTTP module that lets you send HTTP requests from YouTrack. So, for example, once you select a specific enum value in an issue, you can send an HTTP API request to GitLab to create a new branch (basically, it works like a webhook). Alternatively, you can retrieve and process external data as well. This HTTP module can also be used to send requests to a third-party server if you decide to create some app and host it elsewhere.

Additionally, we have a related feature request in our public tracker. If interested, feel free to vote for it. This helps us gauge how much impact this feature will have on our customer base, and you’ll also get subscribed to the issue’s notifications. To do so, sign in to JetBrains YouTrack and hit the thumbs-up icon.

Hello Sergey!

I created an action workflow which creates a branch in GitLab, but my issue is allowing a user to choosing the source branch dynamically. I was hoping in my workflow I could make an HTTP request to GitLab to retrieve all of the current branches then display those in YouTrack and have the user select one, but don't believe that is possible.

After some more research it is my understanding that using userInput with an EnumField type will only pull from EnumFields on the issue or project, is that correct? If using the HTTP request to pull branches from GitLab is not possible my second option was going to be keeping a set of branches in a custom field available to each project, then having the user select one of those when creating a branch.

0

Thanks for your response.

then display those in YouTrack and have the user select one, but don't believe that is possible.

You are correct, that's currently not possible to do dynamically. 

using userInput with an EnumField type will only pull from EnumFields on the issue or project, is that correct?

An issue's enum field shows a predefined set of values that is added to the fields' set in the project. You can't enter arbitrary values. You should use a string-type field for that.

my second option was going to be keeping a set of branches in a custom field available to each project, then having the user select one of those when creating a branch.

Yes, you can do it, but it won't be dynamic, though, i.e., it must be predefined. Theoretically, you can update this set of values per some schedule. You can even use an on-schedule workflow and add new values via this createValue method.

 

0

Thank you for the additional information and the confirmations.

Last question, can automatically open a link from a workflow action? Something similar to:

window.location(https://www.jetbrains.com);
0
Hello Christopher,

Unfortunately, YouTrack workflows don't support any interaction with the browser.

Please let us know if you have further questions.
0

Sergey Merzlov That's really hard to understand why there isn't a create branch functionality in Youtrack yet. I know at least two customers, who don't move from Jira to Youtrack just because this missing feature. It would just cost too much time, if you read your briefing in the ticket and then move to your Git server, navigate to the project, create a branch, type in the task id etc.

0

We appreciate your feedback. We totally agree such a feature would improve the overall experience when working with VCS integrations. However, I'm afraid we still can't share any estimations on when and whether this feature is to be implemented. You can read more about how we handle external requests here.

0

Please sign in to leave a comment.