Chore: [AEA-0000] - only use first line of commit to get ticket#104
Chore: [AEA-0000] - only use first line of commit to get ticket#104anthony-nhs merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the custom semantic-release Jira integration to extract Jira ticket keys only from the first line of each commit message, avoiding matches in multi-line commit bodies.
Changes:
- Extract the first line of
commit.messagebefore applying the Jira ticket regex. - Run ticket matching against that first line rather than the full commit message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| for (const commit of commits) { | ||
| const matches = commit.message.match(jiraRegex) | ||
| const firstLine = commit.message?.split("\n", 1)[0] ?? "" |
There was a problem hiding this comment.
commit.message?.split("\n", 1)[0] doesn’t actually guard against commit.message being null/undefined: the optional chain only applies to the .split(...) call, and indexing [0] on an undefined result would throw. Either remove the optional chaining/nullish coalescing if commit.message is always a string, or make the access fully safe (e.g., optional chain the index access or coerce commit.message to an empty string before splitting).
| const firstLine = commit.message?.split("\n", 1)[0] ?? "" | |
| const firstLine = (commit.message ?? "").split("\n", 1)[0] |
|
This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket: AEA-0000 |
|



Summary
Details