diff options
| author | eric sciple <ericsciple@users.noreply.github.com> | 2019-12-09 19:15:39 -0500 |
|---|---|---|
| committer | eric sciple <ericsciple@users.noreply.github.com> | 2019-12-09 19:15:39 -0500 |
| commit | 850c5af644079513a188c19cd4e77a9cba3ce0a2 (patch) | |
| tree | 3f88eb56a5331aebfd7ae9c83cd9fcdf8fc4e999 /src/github-api-helper.ts | |
| parent | 60d4cd61a0add35bf3fff62db8d96cc40adbdcf3 (diff) | |
.
Diffstat (limited to 'src/github-api-helper.ts')
| -rw-r--r-- | src/github-api-helper.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts index 44fdd73..aa4ded2 100644 --- a/src/github-api-helper.ts +++ b/src/github-api-helper.ts @@ -1,5 +1,13 @@ +import * as assert from 'assert' +import * as core from '@actions/core' +import * as exec from '@actions/exec' +import * as fs from 'fs' import * as github from '@actions/github' +import * as io from '@actions/io' +import * as path from 'path' import {ReposGetArchiveLinkParams} from '@octokit/rest' +import {defaultCoreCipherList} from 'constants' +import {ExecOptions} from '@actions/exec/lib/interfaces' const IS_WINDOWS = process.platform === 'win32' @@ -17,13 +25,21 @@ export async function downloadRepository( repo: repo, ref: ref } + // todo: retry const response = await octokit.repos.getArchiveLink(params) if (response.status != 200) { throw new Error( - `GitHub API call failed with response status '${response.status}': ${response.data}` + `Unexpected response from GitHub API. Status: '${response.status}'; Data: '${response.data}'` ) } console.log(`status=${response.status}`) console.log(`headers=${JSON.stringify(response.headers)}`) console.log(`data=${JSON.stringify(typeof response.data)}`) + const runnerTemp = process.env['RUNNER_TEMP'] as string + assert.ok(runnerTemp, 'RUNNER_TEMP not defined') + const archiveFile = path.join(runnerTemp, 'checkout.tar.gz') + await fs.promises.writeFile(archiveFile, response.data) + await exec.exec(`tar -xzf "${archiveFile}"`, [], { + cwd: repositoryPath + } as ExecOptions) } |
