From 214bf1a74ac4bad0760e82d8034acaf0f3821801 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Tue, 12 Dec 2023 11:26:23 +0100 Subject: [PATCH] Exclude files without blob_url when getting PR blobs (#162) * Exclude files without blob_url when getting PR blobs * Update release code --- dist/index.js | 4 ++-- src/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4c5ab3f..8f428b8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14701,8 +14701,8 @@ async function getPrFilesWithBlobSize(pullRequestNumber) { }) : data; const prFilesWithBlobSize = await Promise.all(files - // Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) - .filter(file => file.sha != null) + // Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) or without blob_url (e.g. submodules) + .filter(file => file.sha != null && file.blob_url != null) .map(async (file) => { const { filename, sha, patch } = file; const { data: blob } = await octokit.rest.git.getBlob({ diff --git a/src/index.ts b/src/index.ts index a3bad0e..9894510 100644 --- a/src/index.ts +++ b/src/index.ts @@ -199,8 +199,8 @@ async function getPrFilesWithBlobSize(pullRequestNumber: number) { const prFilesWithBlobSize = await Promise.all( files - // Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) - .filter(file => file.sha != null) + // Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) or without blob_url (e.g. submodules) + .filter(file => file.sha != null && file.blob_url != null) .map(async file => { const {filename, sha, patch} = file; const {data: blob} = await octokit.rest.git.getBlob({