Skip to content

Chore: [AEA-0000] - only use first line of commit to get ticket#104

Merged
anthony-nhs merged 1 commit intomainfrom
another_regex_fix
Mar 23, 2026
Merged

Chore: [AEA-0000] - only use first line of commit to get ticket#104
anthony-nhs merged 1 commit intomainfrom
another_regex_fix

Conversation

@anthony-nhs
Copy link
Contributor

Summary

  • Routine Change

Details

  • only use first line of commit to get ticket

Copilot AI review requested due to automatic review settings March 23, 2026 12:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.message before 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] ?? ""
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
const firstLine = commit.message?.split("\n", 1)[0] ?? ""
const firstLine = (commit.message ?? "").split("\n", 1)[0]

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:

AEA-0000

@sonarqubecloud
Copy link

@anthony-nhs anthony-nhs merged commit 132c0f2 into main Mar 23, 2026
15 checks passed
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.

2 participants