mirror of
https://github.com/actions/checkout.git
synced 2025-03-31 05:20:06 +02:00
.
This commit is contained in:
parent
655bd49ac6
commit
bdbd8b81c2
3 changed files with 19 additions and 4 deletions
12
dist/index.js
vendored
12
dist/index.js
vendored
|
@ -8438,7 +8438,12 @@ function downloadRepository(accessToken, owner, repo, ref, commit, repositoryPat
|
|||
for (const fileName of yield fs.promises.readdir(tempRepositoryPath)) {
|
||||
const sourcePath = path.join(tempRepositoryPath, fileName);
|
||||
const targetPath = path.join(repositoryPath, fileName);
|
||||
yield io.mv(sourcePath, targetPath);
|
||||
if (IS_WINDOWS) {
|
||||
yield io.cp(sourcePath, targetPath); // Copy on Windows in case Windows Defender has a lock on the files
|
||||
}
|
||||
else {
|
||||
yield io.mv(sourcePath, targetPath);
|
||||
}
|
||||
}
|
||||
io.rmRF(extractPath);
|
||||
});
|
||||
|
@ -8455,7 +8460,7 @@ function downloadArchive(accessToken, owner, repo, ref, commit) {
|
|||
};
|
||||
const response = yield octokit.repos.getArchiveLink(params);
|
||||
if (response.status != 200) {
|
||||
throw new Error(`Unexpected response from GitHub API. Status: '${response.status}'`);
|
||||
throw new Error(`Unexpected response from GitHub API. Status: ${response.status}, Data: ${response.data}`);
|
||||
}
|
||||
return Buffer.from(response.data); // response.data is ArrayBuffer
|
||||
});
|
||||
|
@ -9802,6 +9807,9 @@ class RetryHelper {
|
|||
this.maxAttempts = maxAttempts;
|
||||
this.minSeconds = Math.floor(minSeconds);
|
||||
this.maxSeconds = Math.floor(maxSeconds);
|
||||
if (this.minSeconds > this.maxAttempts) {
|
||||
throw new Error('min seconds should be less than or equal to max seconds');
|
||||
}
|
||||
}
|
||||
execute(action) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
|
@ -58,7 +58,11 @@ export async function downloadRepository(
|
|||
for (const fileName of await fs.promises.readdir(tempRepositoryPath)) {
|
||||
const sourcePath = path.join(tempRepositoryPath, fileName)
|
||||
const targetPath = path.join(repositoryPath, fileName)
|
||||
await io.mv(sourcePath, targetPath)
|
||||
if (IS_WINDOWS) {
|
||||
await io.cp(sourcePath, targetPath) // Copy on Windows in case Windows Defender has a lock on the files
|
||||
} else {
|
||||
await io.mv(sourcePath, targetPath)
|
||||
}
|
||||
}
|
||||
io.rmRF(extractPath)
|
||||
}
|
||||
|
@ -80,7 +84,7 @@ async function downloadArchive(
|
|||
const response = await octokit.repos.getArchiveLink(params)
|
||||
if (response.status != 200) {
|
||||
throw new Error(
|
||||
`Unexpected response from GitHub API. Status: '${response.status}'`
|
||||
`Unexpected response from GitHub API. Status: ${response.status}, Data: ${response.data}`
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ export class RetryHelper {
|
|||
this.maxAttempts = maxAttempts
|
||||
this.minSeconds = Math.floor(minSeconds)
|
||||
this.maxSeconds = Math.floor(maxSeconds)
|
||||
if (this.minSeconds > this.maxAttempts) {
|
||||
throw new Error('min seconds should be less than or equal to max seconds')
|
||||
}
|
||||
}
|
||||
|
||||
async execute<T>(action: () => Promise<T>): Promise<T> {
|
||||
|
|
Loading…
Add table
Reference in a new issue