@@ -17,14 +17,14 @@ export interface GitInfo {
1717 url : string
1818}
1919
20- export async function downloadRepository ( url : string , cwd : string ) {
20+ export async function downloadRepository ( url : string , cwd : string , { headers } : { headers ?: Record < string , string > } = { } ) {
2121 const tarFile = join ( cwd , '.content.clone.tar.gz' )
2222 const cacheFile = join ( cwd , '.content.cache.json' )
2323
2424 const cache = await readFile ( cacheFile , 'utf8' ) . then ( d => JSON . parse ( d ) ) . catch ( ( ) => null )
2525 if ( cache ) {
2626 // Directory exists, skip download
27- const response = await fetch ( url , { method : 'HEAD' } )
27+ const response = await fetch ( url , { method : 'HEAD' , headers } )
2828 const etag = response . headers . get ( 'etag' )
2929 if ( etag === cache . etag ) {
3030 await writeFile ( cacheFile , JSON . stringify ( {
@@ -38,7 +38,7 @@ export async function downloadRepository(url: string, cwd: string) {
3838 await mkdir ( cwd , { recursive : true } )
3939
4040 try {
41- const response = await fetch ( url )
41+ const response = await fetch ( url , { headers } )
4242 const stream = createWriteStream ( tarFile )
4343 await promisify ( pipeline ) ( response . body as unknown as ReadableStream [ ] , stream )
4444
0 commit comments