File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/build/src/extensions/core Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export function syncVercelEnvVars(options?: {
5
5
projectId ?: string ;
6
6
vercelAccessToken ?: string ;
7
7
vercelTeamId ?: string ;
8
+ branch ?: string ;
8
9
} ) : BuildExtension {
9
10
const sync = syncEnvVars ( async ( ctx ) => {
10
11
const projectId =
@@ -13,6 +14,17 @@ export function syncVercelEnvVars(options?: {
13
14
options ?. vercelAccessToken ?? process . env . VERCEL_ACCESS_TOKEN ?? ctx . env . VERCEL_ACCESS_TOKEN ;
14
15
const vercelTeamId =
15
16
options ?. vercelTeamId ?? process . env . VERCEL_TEAM_ID ?? ctx . env . VERCEL_TEAM_ID ;
17
+ const branch =
18
+ options ?. branch ??
19
+ process . env . VERCEL_PREVIEW_BRANCH ??
20
+ ctx . env . VERCEL_PREVIEW_BRANCH ??
21
+ ctx . branch ;
22
+
23
+ console . debug ( "syncVercelEnvVars()" , {
24
+ projectId,
25
+ vercelTeamId,
26
+ branch,
27
+ } ) ;
16
28
17
29
if ( ! projectId ) {
18
30
throw new Error (
@@ -42,7 +54,7 @@ export function syncVercelEnvVars(options?: {
42
54
}
43
55
const params = new URLSearchParams ( { decrypt : "true" } ) ;
44
56
if ( vercelTeamId ) params . set ( "teamId" , vercelTeamId ) ;
45
- if ( ctx . branch ) params . set ( "gitBranch" , ctx . branch ) ;
57
+ if ( branch ) params . set ( "gitBranch" , branch ) ;
46
58
const vercelApiUrl = `https://api.vercel.com/v8/projects/${ projectId } /env?${ params } ` ;
47
59
48
60
try {
You can’t perform that action at this time.
0 commit comments