mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
fix: skip SHA computation for deleted files (#115)
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
|
import type { Octokits } from "../api/client";
|
||||||
|
import { ISSUE_QUERY, PR_QUERY } from "../api/queries/github";
|
||||||
import type {
|
import type {
|
||||||
GitHubPullRequest,
|
|
||||||
GitHubIssue,
|
|
||||||
GitHubComment,
|
GitHubComment,
|
||||||
GitHubFile,
|
GitHubFile,
|
||||||
|
GitHubIssue,
|
||||||
|
GitHubPullRequest,
|
||||||
GitHubReview,
|
GitHubReview,
|
||||||
PullRequestQueryResponse,
|
|
||||||
IssueQueryResponse,
|
IssueQueryResponse,
|
||||||
|
PullRequestQueryResponse,
|
||||||
} from "../types";
|
} from "../types";
|
||||||
import { PR_QUERY, ISSUE_QUERY } from "../api/queries/github";
|
|
||||||
import type { Octokits } from "../api/client";
|
|
||||||
import { downloadCommentImages } from "../utils/image-downloader";
|
|
||||||
import type { CommentWithImages } from "../utils/image-downloader";
|
import type { CommentWithImages } from "../utils/image-downloader";
|
||||||
|
import { downloadCommentImages } from "../utils/image-downloader";
|
||||||
|
|
||||||
type FetchDataParams = {
|
type FetchDataParams = {
|
||||||
octokits: Octokits;
|
octokits: Octokits;
|
||||||
@@ -101,6 +101,14 @@ export async function fetchGitHubData({
|
|||||||
let changedFilesWithSHA: GitHubFileWithSHA[] = [];
|
let changedFilesWithSHA: GitHubFileWithSHA[] = [];
|
||||||
if (isPR && changedFiles.length > 0) {
|
if (isPR && changedFiles.length > 0) {
|
||||||
changedFilesWithSHA = changedFiles.map((file) => {
|
changedFilesWithSHA = changedFiles.map((file) => {
|
||||||
|
// Don't compute SHA for deleted files
|
||||||
|
if (file.changeType === "DELETED") {
|
||||||
|
return {
|
||||||
|
...file,
|
||||||
|
sha: "deleted",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Use git hash-object to compute the SHA for the current file content
|
// Use git hash-object to compute the SHA for the current file content
|
||||||
const sha = execSync(`git hash-object "${file.path}"`, {
|
const sha = execSync(`git hash-object "${file.path}"`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user