diff options
| author | eric sciple <ericsciple@users.noreply.github.com> | 2019-12-10 02:58:11 -0500 |
|---|---|---|
| committer | eric sciple <ericsciple@users.noreply.github.com> | 2019-12-10 02:58:11 -0500 |
| commit | 6569813a4247155d52fdd1cc69607af6e93239b3 (patch) | |
| tree | 5d7e0c2935f6a6ab0b7b0e473c2f8666638549d2 /src/github-api-helper.ts | |
| parent | 4a3fee4df21eec578110d41563552655eff7f0db (diff) | |
.
Diffstat (limited to 'src/github-api-helper.ts')
| -rw-r--r-- | src/github-api-helper.ts | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts index 0be91f2..b3385a5 100644 --- a/src/github-api-helper.ts +++ b/src/github-api-helper.ts @@ -36,13 +36,13 @@ export async function downloadRepository( // Download the archive let archiveData = await retryHelper.execute(async () => { core.info('Downloading the archive using the REST API') - await await downloadArchive(accessToken, owner, repo, ref, commit) + return await downloadArchive(accessToken, owner, repo, ref, commit) }) // Write archive to disk core.info('Writing archive to disk') await fs.promises.writeFile(archivePath, archiveData) - archiveData = undefined + archiveData = Buffer.from('') // Free memory // // Get the archive URL using the REST API // await retryHelper.execute(async () => { @@ -72,35 +72,13 @@ export async function downloadRepository( // } // }) - // return Buffer.from(response.data) // response.data is ArrayBuffer - - // // Download the archive - // core.info('Downloading the archive') // Do not print the URL since it contains a token to download the archive - // await downloadFile(archiveUrl, archivePath) - - // // console.log(`status=${response.status}`) - // // console.log(`headers=${JSON.stringify(response.headers)}`) - // // console.log(`data=${response.data}`) - // // console.log(`data=${JSON.stringify(response.data)}`) - // // for (const key of Object.keys(response.data)) { - // // console.log(`data['${key}']=${response.data[key]}`) - // // } - - // // Write archive to file - // const runnerTemp = process.env['RUNNER_TEMP'] as string - // assert.ok(runnerTemp, 'RUNNER_TEMP not defined') - // const archivePath = path.join(runnerTemp, 'checkout.tar.gz') - // await io.rmRF(archivePath) // await fs.promises.writeFile(archivePath, raw) // // await exec.exec(`ls -la "${archiveFile}"`, [], { // // cwd: repositoryPath // // } as ExecOptions) // Extract archive - const extractPath = path.join( - runnerTemp, - `checkout-archive${IS_WINDOWS ? '.zip' : '.tar.gz'}` - ) + const extractPath = path.join(runnerTemp, `checkout`) await io.rmRF(extractPath) await io.mkdirP(extractPath) if (IS_WINDOWS) { @@ -160,14 +138,6 @@ async function downloadArchive( } return Buffer.from(response.data) // response.data is ArrayBuffer - - // console.log('GETTING THE LOCATION') - // const archiveUrl = response.headers['Location'] // Do not print the archive URL because it has an embedded token - // assert.ok( - // archiveUrl, - // `Expected GitHub API response to contain 'Location' header` - // ) - // return archiveUrl } // async function getArchiveUrl( |
