Skip to content

Commit

Permalink
fix(github): pull body can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
korthout committed Dec 24, 2021
1 parent 3e2f501 commit e70ae85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Github implements GithubApi {
export type PullRequest = {
number: number;
title: string;
body: string;
body: string | null;
head: {
sha: string;
};
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function composeBody(

type PullRequest = {
number: number;
body: string;
body: string | null;
user: {
login: string;
};
Expand All @@ -29,10 +29,10 @@ type PullRequest = {
* @param body Text in which to search for mentioned issues
* @returns All found mentioned issues as GitHub issue references
*/
export function getMentionedIssueRefs(body: string): string[] {
export function getMentionedIssueRefs(body: string | null): string[] {
const issueUrls =
body.match(patterns.url.global)?.map((url) => toRef(url)) ?? [];
const issueRefs = body.match(patterns.ref) ?? [];
body?.match(patterns.url.global)?.map((url) => toRef(url)) ?? [];
const issueRefs = body?.match(patterns.ref) ?? [];
return issueUrls.concat(issueRefs).map((ref) => ref.trim());
}

Expand Down

0 comments on commit e70ae85

Please sign in to comment.