fix(windows): recreate empty runner checkout before actions start

This commit is contained in:
winewill committed 2026-10-09 16:01:20 +08:00
1 parent 370a272bb1
commit 5801fae7dc
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
for ($item = [IO.DirectoryInfo]::new($workspace); $null -ne $item; $item = $item.Parent) {
if ($item.Exists -and ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) { throw 'Checkout ancestors cannot be links' }
}
node -e "require('node:fs').rmSync(process.argv[1], { recursive: true, force: true, maxRetries: 3 })" $workspace
node -e "const fs = require('node:fs'); fs.rmSync(process.argv[1], { recursive: true, force: true, maxRetries: 3 }); fs.mkdirSync(process.argv[1])" $workspace
if ($LASTEXITCODE -ne 0) { throw 'Checkout cleanup failed' }
- uses: actions/[email protected]
id: checkout
+3 -1
View File
@@ -45,9 +45,11 @@ it.skipIf(process.platform !== 'win32')('resets only the allocated checkout with
stdio: 'pipe',
})
run(workspace)
expect(existsSync(workspace)).toBe(false)
expect(existsSync(workspace)).toBe(true)
expect(existsSync(resolve(workspace, 'node_modules'))).toBe(false)
expect(readFileSync(resolve(external, 'keep.txt'), 'utf8')).toBe('keep')
expect(() => run(external)).toThrow()
rmSync(workspace, { recursive: true })
symlinkSync(external, workspace, 'junction')
expect(() => run(workspace)).toThrow()
expect(readFileSync(resolve(external, 'keep.txt'), 'utf8')).toBe('keep')