File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import {
2525 SandboxListResponse ,
2626 SandboxPrivacy ,
2727 StartSandboxOpts ,
28+ SessionCreateOptions ,
2829} from "./types" ;
2930import { PitcherManagerResponse } from "@codesandbox/pitcher-client" ;
3031
@@ -75,21 +76,21 @@ export class Sandboxes {
7576 id : opts . templateId || this . defaultTemplateId ,
7677 } ) ;
7778
78- const session = await sandbox . connect (
79- // We do not want users to pass gitAccessToken on global user, because it
80- // can be read by other users
81- {
82- id : "clone-repo-user " ,
83- permission : "write" ,
84- ... ( opts . config
85- ? {
86- gitAccessToken : opts . config . accessToken ,
87- email : opts . config . email ,
88- name : opts . config . name ,
89- }
90- : { } ) ,
91- }
92- ) ;
79+ // We do not want users to pass gitAccessToken on global user, because it
80+ // can be read by other users
81+ const sessionCreateOptions : SessionCreateOptions = {
82+ id : "clone-repo-user" ,
83+ permission : "write " ,
84+ } ;
85+ if ( opts . config ) {
86+ sessionCreateOptions . git = {
87+ accessToken : opts . config . accessToken ,
88+ email : opts . config . email ,
89+ name : opts . config . name ,
90+ } ;
91+ }
92+
93+ const session = await sandbox . connect ( sessionCreateOptions ) ;
9394
9495 await session . commands . run ( [
9596 "rm -rf .git" ,
You can’t perform that action at this time.
0 commit comments