semantic-release-linear-app 0.7.0 → 0.7.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/parse-issues.js
CHANGED
|
@@ -12,8 +12,9 @@ export function parseIssuesFromBranch(branchName, teamKeys = null) {
|
|
|
12
12
|
const issues = new Set();
|
|
13
13
|
// Build regex pattern based on team keys
|
|
14
14
|
const teamPattern = teamKeys ? `(?:${teamKeys.join('|')})` : '[A-Z]+';
|
|
15
|
-
// Pattern matches: feature/ENG-123-description, ENG-123, bugfix/FEAT-45, etc.
|
|
16
|
-
|
|
15
|
+
// Pattern matches: feature/ENG-123-description, ENG-123, bugfix/FEAT-45, sd-1681_desc, etc.
|
|
16
|
+
// Uses lookahead instead of trailing \b so underscores after the number don't prevent matching
|
|
17
|
+
const issuePattern = new RegExp(`\\b(${teamPattern}-\\d+)(?=[^\\d]|$)`, 'gi');
|
|
17
18
|
const matches = Array.from(branchName.matchAll(issuePattern));
|
|
18
19
|
for (const match of matches) {
|
|
19
20
|
issues.add(match[1].toUpperCase());
|
|
@@ -17,6 +17,11 @@ describe('parse-issues', () => {
|
|
|
17
17
|
const result = parseIssuesFromBranch(branchName, ['ENG']);
|
|
18
18
|
expect(result).toEqual(['ENG-123']);
|
|
19
19
|
});
|
|
20
|
+
test('extracts issue ID when followed by underscore', () => {
|
|
21
|
+
const branchName = 'sd-1681_block-id-crash';
|
|
22
|
+
const result = parseIssuesFromBranch(branchName, ['SD']);
|
|
23
|
+
expect(result).toEqual(['SD-1681']);
|
|
24
|
+
});
|
|
20
25
|
test('returns empty array for branch without issues', () => {
|
|
21
26
|
const branchName = 'feature/no-issues-here';
|
|
22
27
|
const result = parseIssuesFromBranch(branchName);
|
package/package.json
CHANGED
|
@@ -21,6 +21,12 @@ describe('parse-issues', () => {
|
|
|
21
21
|
expect(result).toEqual(['ENG-123']);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
test('extracts issue ID when followed by underscore', () => {
|
|
25
|
+
const branchName = 'sd-1681_block-id-crash';
|
|
26
|
+
const result = parseIssuesFromBranch(branchName, ['SD']);
|
|
27
|
+
expect(result).toEqual(['SD-1681']);
|
|
28
|
+
});
|
|
29
|
+
|
|
24
30
|
test('returns empty array for branch without issues', () => {
|
|
25
31
|
const branchName = 'feature/no-issues-here';
|
|
26
32
|
const result = parseIssuesFromBranch(branchName);
|
package/src/lib/parse-issues.ts
CHANGED
|
@@ -18,8 +18,9 @@ export function parseIssuesFromBranch(
|
|
|
18
18
|
// Build regex pattern based on team keys
|
|
19
19
|
const teamPattern = teamKeys ? `(?:${teamKeys.join('|')})` : '[A-Z]+';
|
|
20
20
|
|
|
21
|
-
// Pattern matches: feature/ENG-123-description, ENG-123, bugfix/FEAT-45, etc.
|
|
22
|
-
|
|
21
|
+
// Pattern matches: feature/ENG-123-description, ENG-123, bugfix/FEAT-45, sd-1681_desc, etc.
|
|
22
|
+
// Uses lookahead instead of trailing \b so underscores after the number don't prevent matching
|
|
23
|
+
const issuePattern = new RegExp(`\\b(${teamPattern}-\\d+)(?=[^\\d]|$)`, 'gi');
|
|
23
24
|
|
|
24
25
|
const matches = Array.from(branchName.matchAll(issuePattern));
|
|
25
26
|
for (const match of matches) {
|