Open arkadioz opened 10 months ago
No not possible to change the order. Labeling this as enhancement.
Okay thank you @tomasbjerre,
Is it possible to make a function that can recognize if the commit msg contains a Jira issue and if it does return it? I think it might be possible with javascript in the template, for example:
In my case you usually find commit msgs like "ACR-750 more or less short description" or "TLYPY-1123: more or less short description" most times this issue is also present in branch name.
maybe a function like getJiraIssueFromCommit(String commitMsg)
that would return the Jira issue (if present), so that you could use that in the template for linking it and use it in the template like so:
Jira ID in commit: [getJiraIssueFromCommit({{messageTitle}})](https://server.atlassian.net/browse/getJiraIssueFromCommit({{messageTitle}}))
Would result in:
Jira ID in commit: [ACR-750](https://server.atlassian.net/browse/ACR-750)
EDIT: This is already done, focus on the enhancement of the ordering 👍
When integrating with Jira I notice that the information is presented ordered by the jira issue name, and inside the issue, the commits that were made, you can notice this behaviour in this example https://github.com/tomasbjerre/git-changelog-lib/blob/master/examples/bitbucket_jira.html (notice that SS-165 has an older commit than SS-167, is there a way to make the SS-167 appear first because it is a newer change/commit?).
Based on the example I mentioned, I did this .md template which is successfully gathering the jira issues and also the commits related to them, also the ordering is like in the example above:
is it possible to apply the ordering I need to it (newest commits first with the respective jira issues)?
Also I was wondering if maybe changing the order of the context variables would help, putting first the
{{#commits}}
and then inside it{{#issues}} {{#hasIssue}}
to make it prioritize the ordering with the commits, but the problem is that I could not figure out if there is a way to check if the commit has a jira issue, like a context variable like {{hasJiraIssue}}.I was checking if the commits had an inner attribute that I could use for that https://github.com/tomasbjerre/git-changelog-lib?tab=readme-ov-file#context but cannot really figure out if there is a way, like the only way I see to get the Jira Issue is like in the example I mentioned earlier and in this template I pasted, where you first need to start with opening
{{#issues}} {{#hasIssue}}
and then inside{{#commits}}
and not the other way around.So that you could order by commits and then just show all the Jira issues related to each commit (this would work for me), please let me know if I could properly explain what I am trying to achieve or if needs more detail, I appreciate any help/guidance