atlassian-github-app-addon icon indicating copy to clipboard operation
atlassian-github-app-addon copied to clipboard

Choosing branch name/location

Open jamesgraham opened this issue 7 years ago • 7 comments

Great plugin!

It would be nice if we could choose to create the branch with:

  • a name based on the issue title e.g. ABC-123-slugged-issue-title
  • a location based on the issue type e.g. a story creates in feature/ABC-123 and bug in hotfix/ABC-123 to support gitflow

jamesgraham avatar Jun 09 '18 11:06 jamesgraham

👋 @jamesgraham thanks for your suggestions. I have been tracking this in https://github.com/osowskit/atlassian-github-app-addon/issues/20#issuecomment-395516297 but don't have short-term plans on implementing support for this:

Adding an Admin page will add additional complexity for this plugin. While I agree this feature should be added, I cannot commit resources to implementing this and prefer keeping this as a light-weight reference implementation. Workarounds:

  • Copy the Create a branch URL, edit the URL to contain the desired branch name, execute it in another browser window
  • Write a Chrome extension to replace this via JS
  • Fork this repository and a) hard-code the prefix, b) implement this via front-end code, or c) implement this as an Admin setting

osowskit avatar Jun 18 '18 03:06 osowskit

@osowskit Could this be reopened? From my understanding, #20 supports <issue key>/<custom title set from UI>. This issue requests <location based on issue type>/<issue key>-<custom title set from UI>. We are also interested in this pattern.

kbakk avatar Sep 11 '19 07:09 kbakk

This is a bit trickier to offer because 1) every jira uses different identifiers for issue type and the text value isn't passed to the app and 2) this branch pattern would not be easy to look up in jira.

Could you manually enter the issue type where it would be SENG-1234/bug/manually-entered-title?

osowskit avatar Sep 11 '19 23:09 osowskit

We would like the location to be type - e.g. feature/MD-1234-fantastic-feature. This is according to how git-flow avh works

Could a mapping be added in .github/jira-bot.yaml? Something like

branch_pattern: 1
map_issue:
  Bug: bugfix
  Task: feature
  Story: feature

kbakk avatar Sep 13 '19 12:09 kbakk

@kbakk that is an interesting idea. The main issue is that it isn't easy to get the issue type - say Bug.

If you could provide the issue type id rather than Bug, Task, and Story, I could likely build a mapping to support this. Do you know how to lookup that mapping for your instance? Every Jira will likely be different.

osowskit avatar Sep 13 '19 14:09 osowskit

Sorry for the late response.

In the API it's at https://<instance>.atlassian.net/rest/api/2/project/<project id>, and it can be found by looking at https://<instance>.atlassian.net/secure/admin/ViewIssueTypes.jspa then Edit - the ID will be in the URL.

ID->branch may not be as clear as with names, but for us this should work well.

kbakk avatar Sep 18 '19 17:09 kbakk

@kbakk I'm back to this now. This plugin was designed with minimal permissions so cannot access the JIRA API. It's event-driven and atlassian is passing data via URL params. In this case, they pass a tenant-specific integer, issuetype.id, representing the type rather than the name.

Would users want to create all branches off a single location (static for the project), flexibility per JIRA ticket (i.e. a ticket would represent a 1:1 mapping for fixing in dev or hotfix or main), or would a single JIRA ticket have multiple branches on different locations.

osowskit avatar May 11 '23 18:05 osowskit