Add vercel secret syncs docs

This commit is contained in:
carlosmonastyrski
2025-04-01 10:56:36 -03:00
parent dbabb4f964
commit 90bf8f800b
36 changed files with 299 additions and 25 deletions
+1 -1
View File
@@ -1787,7 +1787,7 @@ export const SecretSyncs = {
app: "The ID of the Vercel app to sync secrets to.",
appName: "The name of the Vercel app to sync secrets to.",
env: "The ID of the Vercel environment to sync secrets to.",
branch: "The branch to sync secrets to. Required for Preview environments."
branch: "The branch to sync preview secrets to."
}
}
};
@@ -155,7 +155,7 @@ async function fetchPreviewBranches(projectId: string, apiToken: string): Promis
}
}
);
return data.map((b) => b.ref);
return data.filter((b) => b.ref !== "main").map((b) => b.ref);
}
type VercelTeam = {
@@ -12,27 +12,14 @@ import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types"
import { VercelEnvironmentType } from "./vercel-sync-enums";
const VercelSyncDestinationConfigSchema = z
.object({
app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
env: z
.enum([VercelEnvironmentType.Development, VercelEnvironmentType.Preview, VercelEnvironmentType.Production])
.describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch)
})
.refine(
(data) => {
if (data.env === VercelEnvironmentType.Preview) {
return !!data.branch && data.branch.trim().length > 0;
}
return true;
},
{
message: "Branch is required for Preview environments",
path: ["branch"]
}
);
const VercelSyncDestinationConfigSchema = z.object({
app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
env: z
.enum([VercelEnvironmentType.Development, VercelEnvironmentType.Preview, VercelEnvironmentType.Production])
.describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch)
});
const VercelSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };