File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
packages/build/src/extensions/core Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @trigger.dev/build " : patch
3+ ---
4+
5+ syncVercelEnvVars() fix for syncing the wrong preview branch env vars
Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import { syncEnvVars } from "../core.js";
33
44type EnvVar = { name : string ; value : string ; isParentEnv ?: boolean } ;
55
6+ type VercelEnvVar = {
7+ key : string ;
8+ value : string ;
9+ type : string ;
10+ target : string [ ] ;
11+ gitBranch ?: string ;
12+ } ;
13+
614export function syncVercelEnvVars ( options ?: {
715 projectId ?: string ;
816 vercelAccessToken ?: string ;
@@ -72,11 +80,13 @@ export function syncVercelEnvVars(options?: {
7280 const isBranchable = ctx . environment === "preview" ;
7381
7482 const filteredEnvs : EnvVar [ ] = data . envs
75- . filter (
76- ( env : { type : string ; value : string ; target : string [ ] } ) =>
77- env . value && env . target . includes ( vercelEnvironment )
78- )
79- . map ( ( env : { key : string ; value : string ; gitBranch ?: string } ) => {
83+ . filter ( ( env : VercelEnvVar ) => {
84+ if ( ! env . value ) return false ;
85+ if ( ! env . target . includes ( vercelEnvironment ) ) return false ;
86+ if ( isBranchable && env . gitBranch && env . gitBranch !== branch ) return false ;
87+ return true ;
88+ } )
89+ . map ( ( env : VercelEnvVar ) => {
8090 return {
8191 name : env . key ,
8292 value : env . value ,
You can’t perform that action at this time.
0 commit comments