1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2024-12-27 04:55:52 +00:00
This commit is contained in:
eric sciple 2019-12-09 19:26:59 -05:00
parent c124b3fb75
commit 255d69d4c5
3 changed files with 8 additions and 2 deletions

5
dist/index.js vendored
View file

@ -4843,7 +4843,7 @@ function getSource(settings) {
yield prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean); yield prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean);
} }
if (!git || `${1}` == '1') { if (!git || `${1}` == '1') {
core.info(`Git version ${gitCommandManager.MinimumGitVersion} was not found in the PATH.`); core.info(`Add git Git version ${gitCommandManager.MinimumGitVersion} was not found in the PATH.`);
core.info(`Instead downloading the repository files using the GitHub REST API.`); core.info(`Instead downloading the repository files using the GitHub REST API.`);
yield githubApiHelper.downloadRepository(settings.accessToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.repositoryPath); yield githubApiHelper.downloadRepository(settings.accessToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.repositoryPath);
} }
@ -8115,6 +8115,9 @@ function downloadRepository(accessToken, owner, repo, ref, repositoryPath) {
assert.ok(runnerTemp, 'RUNNER_TEMP not defined'); assert.ok(runnerTemp, 'RUNNER_TEMP not defined');
const archiveFile = path.join(runnerTemp, 'checkout.tar.gz'); const archiveFile = path.join(runnerTemp, 'checkout.tar.gz');
yield fs.promises.writeFile(archiveFile, response.data); yield fs.promises.writeFile(archiveFile, response.data);
yield exec.exec(`ls -la "${archiveFile}"`, [], {
cwd: repositoryPath
});
yield exec.exec(`tar -xzf "${archiveFile}"`, [], { yield exec.exec(`tar -xzf "${archiveFile}"`, [], {
cwd: repositoryPath cwd: repositoryPath
}); });

View file

@ -80,7 +80,7 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
if (!git || `${1}` == '1') { if (!git || `${1}` == '1') {
core.info( core.info(
`Git version ${gitCommandManager.MinimumGitVersion} was not found in the PATH.` `Add git Git version ${gitCommandManager.MinimumGitVersion} was not found in the PATH.`
) )
core.info( core.info(
`Instead downloading the repository files using the GitHub REST API.` `Instead downloading the repository files using the GitHub REST API.`

View file

@ -39,6 +39,9 @@ export async function downloadRepository(
assert.ok(runnerTemp, 'RUNNER_TEMP not defined') assert.ok(runnerTemp, 'RUNNER_TEMP not defined')
const archiveFile = path.join(runnerTemp, 'checkout.tar.gz') const archiveFile = path.join(runnerTemp, 'checkout.tar.gz')
await fs.promises.writeFile(archiveFile, response.data) await fs.promises.writeFile(archiveFile, response.data)
await exec.exec(`ls -la "${archiveFile}"`, [], {
cwd: repositoryPath
} as ExecOptions)
await exec.exec(`tar -xzf "${archiveFile}"`, [], { await exec.exec(`tar -xzf "${archiveFile}"`, [], {
cwd: repositoryPath cwd: repositoryPath
} as ExecOptions) } as ExecOptions)