mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
feat: defer remote branch creation until first commit (#244)
* feat: defer remote branch creation until first commit - For commit signing: branches are created remotely by github-file-ops-server on first commit - For non-signing: branches are created locally with 'git checkout -b' and pushed when needed - Consolidated duplicate branch creation logic in github-file-ops-server into a shared helper function - Claude is unaware of these implementation details and simply sees it's on the correct branch - No branch links are shown in initial comments since branches don't exist remotely yet * fix: prevent broken branch links in final comment update - Check if branch exists remotely before adding branch link - Only add branch links for branches that actually exist on GitHub - Add test coverage for non-existent remote branches - Fixes issue where users would see broken branch links for local-only branches * fix: don't show branch name in comment header when branch doesn't exist remotely - Only pass branchName to updateCommentBody when branchLink exists - Prevents showing branch names for branches that only exist locally - Add test to verify branch name is not shown when branch doesn't exist * tmp
This commit is contained in:
@@ -12,7 +12,6 @@ import { checkHumanActor } from "../github/validation/actor";
|
||||
import { checkWritePermissions } from "../github/validation/permissions";
|
||||
import { createInitialComment } from "../github/operations/comments/create-initial";
|
||||
import { setupBranch } from "../github/operations/branch";
|
||||
import { updateTrackingComment } from "../github/operations/comments/update-with-branch";
|
||||
import { configureGitAuth } from "../github/operations/git-config";
|
||||
import { prepareMcpConfig } from "../mcp/install-mcp-server";
|
||||
import { createPrompt } from "../create-prompt";
|
||||
@@ -67,17 +66,7 @@ async function run() {
|
||||
// Step 8: Setup branch
|
||||
const branchInfo = await setupBranch(octokit, githubData, context);
|
||||
|
||||
// Step 9: Update initial comment with branch link (only for issues that created a new branch)
|
||||
if (branchInfo.claudeBranch) {
|
||||
await updateTrackingComment(
|
||||
octokit,
|
||||
context,
|
||||
commentId,
|
||||
branchInfo.claudeBranch,
|
||||
);
|
||||
}
|
||||
|
||||
// Step 10: Configure git authentication if not using commit signing
|
||||
// Step 9: Configure git authentication if not using commit signing
|
||||
if (!context.inputs.useCommitSigning) {
|
||||
try {
|
||||
await configureGitAuth(githubToken, context, commentData.user);
|
||||
@@ -87,7 +76,7 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
// Step 11: Create prompt file
|
||||
// Step 10: Create prompt file
|
||||
await createPrompt(
|
||||
commentId,
|
||||
branchInfo.baseBranch,
|
||||
@@ -96,7 +85,7 @@ async function run() {
|
||||
context,
|
||||
);
|
||||
|
||||
// Step 12: Get MCP configuration
|
||||
// Step 11: Get MCP configuration
|
||||
const additionalMcpConfig = process.env.MCP_CONFIG || "";
|
||||
const mcpConfig = await prepareMcpConfig({
|
||||
githubToken,
|
||||
|
||||
Reference in New Issue
Block a user