diff --git a/src/helpers/__tests__/issue.spec.ts b/src/helpers/__tests__/issue.spec.ts index e6a3136..fc302a1 100644 --- a/src/helpers/__tests__/issue.spec.ts +++ b/src/helpers/__tests__/issue.spec.ts @@ -17,7 +17,7 @@ describe('extractIssueNumbers function', () => { it('should extract issue numbers when surrounded by non-alphanumeric characters', () => { const input = 'Issue: (ABC-789), Dash-123, Colon:XYZ-456'; - const expectedOutput = ['ABC-789', 'XYZ-456']; + const expectedOutput = ['ABC-789', 'DASH-123', 'XYZ-456']; expect(extractIssueNumbers(input)).toEqual(expectedOutput); }); diff --git a/src/helpers/github.ts b/src/helpers/github.ts index 5af9da6..07bbef6 100644 --- a/src/helpers/github.ts +++ b/src/helpers/github.ts @@ -61,6 +61,10 @@ export async function getPullRequestIssueIds(pr: PullRequestType): Promise ids.add(id)); } + if (typeof pr.head?.ref === 'string') { + extractIssueNumbers(pr.head.ref).map((id) => ids.add(id)); + } + return [...ids]; } diff --git a/src/helpers/issue.ts b/src/helpers/issue.ts index e86bec1..f27d5fb 100644 --- a/src/helpers/issue.ts +++ b/src/helpers/issue.ts @@ -1,7 +1,7 @@ -const ISSUE_PATTERN_RE = /(? = new Set(); - string.match(ISSUE_PATTERN_RE)?.forEach((issue) => result.add(issue)); + string.match(ISSUE_PATTERN_RE)?.forEach((issue) => result.add(issue.toUpperCase())); return [...result]; }