File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
packages/build/src/extensions/core Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import { syncEnvVars } from "../core.js";
3
3
4
4
type EnvVar = { name : string ; value : string ; isParentEnv ?: boolean } ;
5
5
6
+ type VercelEnvVar = {
7
+ key : string ;
8
+ value : string ;
9
+ type : string ;
10
+ target : string [ ] ;
11
+ gitBranch ?: string ;
12
+ } ;
13
+
6
14
export function syncVercelEnvVars ( options ?: {
7
15
projectId ?: string ;
8
16
vercelAccessToken ?: string ;
@@ -72,11 +80,13 @@ export function syncVercelEnvVars(options?: {
72
80
const isBranchable = ctx . environment === "preview" ;
73
81
74
82
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 ) => {
80
90
return {
81
91
name : env . key ,
82
92
value : env . value ,
You can’t perform that action at this time.
0 commit comments