mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
Add check for empty template-generated name
This commit is contained in:
@@ -99,20 +99,19 @@ export function generateBranchName(
|
|||||||
title,
|
title,
|
||||||
);
|
);
|
||||||
|
|
||||||
let branchName: string;
|
if (template?.trim()) {
|
||||||
|
const branchName = applyBranchTemplate(template, variables);
|
||||||
|
|
||||||
if (template && template.trim()) {
|
// Return generated name if non-empty
|
||||||
// Use custom template
|
if (branchName.trim().length > 0) return branchName;
|
||||||
branchName = applyBranchTemplate(template, variables);
|
|
||||||
} else {
|
// Log fallback when custom template produces empty result
|
||||||
// Use default format (backward compatibility)
|
console.log(
|
||||||
branchName = `${branchPrefix}${entityType}-${entityNumber}-${variables.timestamp}`;
|
`Branch template '${template}' generated empty result, falling back to default format`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure branch name is Kubernetes-compatible:
|
const branchName = `${branchPrefix}${entityType}-${entityNumber}-${variables.timestamp}`;
|
||||||
// - Lowercase only
|
// Kubernetes compatible: lowercase, max 50 chars, alphanumeric and hyphens only
|
||||||
// - Alphanumeric with hyphens
|
|
||||||
// - No underscores
|
|
||||||
// - Max 50 chars (to allow for prefixes)
|
|
||||||
return branchName.toLowerCase().substring(0, 50);
|
return branchName.toLowerCase().substring(0, 50);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user