diff --git a/src/interfaces/github.ts b/src/interfaces/github.ts index 25a1838..af65839 100644 --- a/src/interfaces/github.ts +++ b/src/interfaces/github.ts @@ -1,10 +1,10 @@ export interface ICheckOutput { title: string; message: string; - conclusion: string; + conclusion: "success" | "failure"; } export interface ICreateCheckOutput { checkId: number; - detailsUrl: string | null; + detailsUrl: string | undefined; } diff --git a/src/services/checkRunsService.ts b/src/services/checkRunsService.ts index d02ae62..946a7e9 100644 --- a/src/services/checkRunsService.ts +++ b/src/services/checkRunsService.ts @@ -111,7 +111,7 @@ export const createCheckRun = async ( }); return { checkId: response.data.id, - detailsUrl: response.data.html_url, + detailsUrl: response.data.html_url || undefined, }; } catch (error) { console.log(error); diff --git a/src/utils/message.ts b/src/utils/message.ts index 8634e7d..1cb3a7a 100644 --- a/src/utils/message.ts +++ b/src/utils/message.ts @@ -17,6 +17,7 @@ const byteOptions: BytesOptions = { fixedDecimals: true, unitSeparator: " ", }; +const formatBytes = (byte: number) => bytes(byte, byteOptions) || ""; export const getExtSizeChangeComment = async ( currentSize: number, @@ -29,17 +30,16 @@ export const getExtSizeChangeComment = async ( return json2md([ { collapsible: { - summary: `Extension Size Change:   ${bytes( - sizeDiff, - byteOptions + summary: `Extension Size Change:   ${formatBytes( + sizeDiff )} ${getEmoji(sizeDiff)}`, description: json2md({ table: { headers: ["", ""], rows: [ ["Commit", commitId], - ["Latest release size", bytes(latestReleaseSize, byteOptions)], - ["Current size", bytes(currentSize, byteOptions)], + ["Latest release size", formatBytes(latestReleaseSize)], + ["Current size", formatBytes(currentSize)], ["Percent change", `${percentChange.toFixed(2)} %`], ], },