mirror of
https://github.com/actions/checkout.git
synced 2025-07-12 08:40:45 +00:00
.
This commit is contained in:
parent
655bd49ac6
commit
bdbd8b81c2
3 changed files with 19 additions and 4 deletions
|
@ -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
Add a link
Reference in a new issue