mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
feat(cli): allow skipping branch validation (#6721)
This commit is contained in:
@@ -30,7 +30,7 @@ export async function pushGitSyncSettings(
|
||||
) {
|
||||
// Validate branch configuration like sync commands
|
||||
try {
|
||||
await validateBranchConfiguration();
|
||||
await validateBranchConfiguration({ yes: opts.yes });
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes("overrides")) {
|
||||
log.error(error.message);
|
||||
|
||||
@@ -1265,7 +1265,7 @@ export async function pull(
|
||||
|
||||
// Validate branch configuration early
|
||||
try {
|
||||
await validateBranchConfiguration(false, opts.yes);
|
||||
await validateBranchConfiguration(opts);
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes("overrides")) {
|
||||
log.error(error.message);
|
||||
@@ -1690,7 +1690,7 @@ export async function push(
|
||||
|
||||
// Validate branch configuration early
|
||||
try {
|
||||
await validateBranchConfiguration(false, opts.yes);
|
||||
await validateBranchConfiguration(opts);
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes("overrides")) {
|
||||
log.error(error.message);
|
||||
@@ -2358,6 +2358,7 @@ const command = new Command()
|
||||
.option("--include-groups", "Include syncing groups")
|
||||
.option("--include-settings", "Include syncing workspace settings")
|
||||
.option("--include-key", "Include workspace encryption key")
|
||||
.option("--skip-branch-validation", "Skip git branch validation and prompts")
|
||||
.option("--json-output", "Output results in JSON format")
|
||||
.option(
|
||||
"-i --includes <patterns:file[]>",
|
||||
@@ -2405,6 +2406,7 @@ const command = new Command()
|
||||
.option("--include-groups", "Include syncing groups")
|
||||
.option("--include-settings", "Include syncing workspace settings")
|
||||
.option("--include-key", "Include workspace encryption key")
|
||||
.option("--skip-branch-validation", "Skip git branch validation and prompts")
|
||||
.option("--json-output", "Output results in JSON format")
|
||||
.option(
|
||||
"-i --includes <patterns:file[]>",
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface SyncOptions {
|
||||
includeGroups?: boolean;
|
||||
includeSettings?: boolean;
|
||||
includeKey?: boolean;
|
||||
skipBranchValidation?: boolean;
|
||||
message?: string;
|
||||
includes?: string[];
|
||||
extraIncludes?: string[];
|
||||
@@ -355,10 +356,9 @@ export async function mergeConfigWithConfigFile<T>(
|
||||
|
||||
// Validate branch configuration early in the process
|
||||
export async function validateBranchConfiguration(
|
||||
skipValidation?: boolean,
|
||||
autoAccept?: boolean
|
||||
opts: Pick<SyncOptions, "skipBranchValidation" | "yes">
|
||||
): Promise<void> {
|
||||
if (skipValidation || !isGitRepository()) {
|
||||
if (opts.skipBranchValidation || !isGitRepository()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ export async function validateBranchConfiguration(
|
||||
);
|
||||
|
||||
const shouldCreate =
|
||||
autoAccept ||
|
||||
opts.yes ||
|
||||
(await Confirm.prompt({
|
||||
message: `Create empty branch configuration for '${currentBranch}'?`,
|
||||
default: true,
|
||||
|
||||
Reference in New Issue
Block a user