mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
This reverts commit cefe963a6b.
This commit is contained in:
@@ -14,31 +14,6 @@ export async function checkAndCommitOrDeleteBranch(
|
||||
let shouldDeleteBranch = false;
|
||||
|
||||
if (claudeBranch) {
|
||||
// First check if the branch exists remotely
|
||||
let branchExistsRemotely = false;
|
||||
try {
|
||||
await octokit.rest.repos.getBranch({
|
||||
owner,
|
||||
repo,
|
||||
branch: claudeBranch,
|
||||
});
|
||||
branchExistsRemotely = true;
|
||||
} catch (error: any) {
|
||||
if (error.status === 404) {
|
||||
console.log(`Branch ${claudeBranch} does not exist remotely`);
|
||||
} else {
|
||||
console.error("Error checking if branch exists:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// Only proceed if branch exists remotely
|
||||
if (!branchExistsRemotely) {
|
||||
console.log(
|
||||
`Branch ${claudeBranch} does not exist remotely, no branch link will be added`,
|
||||
);
|
||||
return { shouldDeleteBranch: false, branchLink: "" };
|
||||
}
|
||||
|
||||
// Check if Claude made any commits to the branch
|
||||
try {
|
||||
const { data: comparison } =
|
||||
@@ -106,8 +81,8 @@ export async function checkAndCommitOrDeleteBranch(
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error comparing commits on Claude branch:", error);
|
||||
// If we can't compare but the branch exists remotely, include the branch link
|
||||
console.error("Error checking for commits on Claude branch:", error);
|
||||
// If we can't check, assume the branch has commits to be safe
|
||||
const branchUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user