Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/github/data/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,21 @@ export async function fetchGitHubData({
let changedFilesWithSHA: GitHubFileWithSHA[] = [];
if (isPR && changedFiles.length > 0) {
changedFilesWithSHA = changedFiles.map((file) => {
// Don't compute SHA for deleted files
// Don't compute SHA for deleted or added files - deleted files no longer
// exist, and added files may not exist yet if the PR branch hasn't been
// checked out (fetchGitHubData runs before setupBranch).
if (file.changeType === "DELETED") {
return {
...file,
sha: "deleted",
};
}
if (file.changeType === "ADDED") {
return {
...file,
sha: "added",
};
}

try {
// Use git hash-object to compute the SHA for the current file content
Expand Down