UNPKG

@mediamonks/commitlint-issue-reference

Version:

Ensures your commit messages always include the same issue key as in your branch name

6 lines (5 loc) 293 B
export function getTicketFromBranch(branch, issuePattern) { const issueInBranchRegex = new RegExp(issuePattern, 'gu'); const issueInBranchResult = issueInBranchRegex.exec(branch); return issueInBranchResult?.groups?.issue ?? issueInBranchResult?.[1] ?? issueInBranchResult?.[0]; }