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

feat: expose JiraIssue.BaseURL and JiraIssue.BrowseURL #258

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davidalpert
Copy link

What does this do / why do we need it?

As noted in #251 it is often useful to include in release notes a link to the ticketing system or to the specific work item ticket which may have more information on the requirements or background for that piece of work.

How this PR fixes the problem?

This PR offers a commit which adds two new properties to the object avaialble for reference in the templates:

property source
.JiraIssue.BaseURL the value of options.jira.info.url or JIRA_URL, the Base URL of the Jira instance
.JiraIssue.BrowseURL a default value for viewing issue detail, formed using this template: {{BaseURL}}/browse/{{IssueKey}

What should your reviewer look out for in this PR?

This PR is based on top of #257 so as to reduce merge conflicts, since they both update the Jira features.

Check lists

  • Test passed
  • Coding style (indentation, etc)

Which issue(s) does this PR fix?

Resolves #251

As outlined in git-chglog#183 it can be useful when following the
conventional commit syntax to separate conventional
commit type in the subject from work item references
which often appear in the commit body or commit footer

this commit:

- adds a new config option 'jira.issue.key_pattern' which
  is an optional regex used to match issue keys in the
  commit subject and body

- ensures that the Jira Issue Type does not overwrite a
  Conventional Commit Type; the 'jira.issue.type_maps'
  map is only used as a backup when the Conventional
  Commit Type parsed out of the Subject header is empty

- runs the 'jira.issue.key_pattern' regex against both
  the commit Subject header and the entire commit Body

NOTE: the current code assumes that only one Jira work
      item will be bound to a single commit, and this
      appears consistent with the spirit of Conventional
      Commits. I have sometimes found it useful to write
      a Conventional Commit where one 'fix' can close
      multiple Jira work items, so a future issue/change
      might consider updating the model to support multiple
      Jira work items in a single commit message.
allows the release note templates to easily create hyperlinks
into jira like

    Jira: {{ print .JiraIssue.BaseURL "/browse/" .JiraIssueID }}

or

    Jira: {{ .JiraIssue.BrowseURL }}

resolves: git-chglog#251
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 this pull request may close these issues.

Be able to reference .Info.JiraURL in template
1 participant