Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ppremk committed Aug 29, 2022
2 parents 1650f5b + 7b08791 commit ab55f86
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 23 deletions.
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12806,7 +12806,10 @@ async function getPrFilesWithBlobSize(pullRequestNumber) {
return !isExcluded;
})
: data;
const prFilesWithBlobSize = await Promise.all(files.map(async (file) => {
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)
.map(async (file) => {
const { filename, sha, patch } = file;
const { data: blob } = await octokit.rest.git.getBlob({
...repo,
Expand Down
53 changes: 46 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/ppremk/lfs-warning#readme",
"dependencies": {
"@actions/core": "^1.5.0",
"@actions/core": "^1.9.1",
"@actions/github": "^5.0.0",
"micromatch": "^4.0.4"
},
Expand Down
31 changes: 17 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,24 @@ async function getPrFilesWithBlobSize(pullRequestNumber: number) {
: data;

const prFilesWithBlobSize = await Promise.all(
files.map(async file => {
const {filename, sha, patch} = file;
const {data: blob} = await octokit.rest.git.getBlob({
...repo,
file_sha: sha,
});
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)
.map(async file => {
const {filename, sha, patch} = file;
const {data: blob} = await octokit.rest.git.getBlob({
...repo,
file_sha: sha,
});

return {
filename,
filesha: sha,
fileblobsize: blob.size,
filecontents: blob.content,
patch,
};
})
return {
filename,
filesha: sha,
fileblobsize: blob.size,
filecontents: blob.content,
patch,
};
})
);
return prFilesWithBlobSize;
}
Expand Down

0 comments on commit ab55f86

Please sign in to comment.