Branching From YouTrack Follow
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.
- Part of the Action gives users a list of available branches. This could be populated from an API request to GitLab or
- 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.
Please sign in to leave a comment.
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.
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.
Thanks for your response.
You are correct, that's currently not possible to do dynamically.
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.
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.
Thank you for the additional information and the confirmations.
Last question, can automatically open a link from a workflow action? Something similar to:
Unfortunately, YouTrack workflows don't support any interaction with the browser.
Please let us know if you have further questions.