-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
Using a simple workflow which just checks out the repository
name: JCO
on:
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, windows]
steps:
- uses: actions/checkout@v2a simple powershell script
$time_to_wait = 30
Write-Output "Wait '${time_to_wait}' seconds for the file system to become unlocked."
Start-Sleep -Seconds $time_to_wait
Remove-Item "${env:GITHUB_WORKSPACE}" -Recurse -WhatIf
Remove-Item "${env:RUNNER_WORKSPACE}" -Recurse -WhatIfcalled with ACTIONS_RUNNER_HOOK_JOB_COMPLETED is not able to remove neither GITHUB_WORKSPACE nor RUNNER_WORKSPACE.
Runner Version and Platform
Version of your runner?
2.296.2
OS of the machine running the runner? OSX/Windows/Linux/...
Windows
What's not working?
From documentation I would expect to be able to wipeout the workspace at the end of the run but the Remove-Item command tells me, the directory is locked.
Job Log Output
A job completed hook has been configured by the self-hosted runner administrator
Run '<path to>\sample_cleanup.ps1'
shell: C:\windows\System32\WindowsPowerShell\v1.0\powershell.EXE -command ". '{0}'"
Wait '30' seconds for the file system to become unlocked.
Remove-Item : Cannot remove the item at 'C:\github_work\<repository name>\<repository name>'
because it is in use.
At <path to>\sample_cleanup.ps1:4 char:1
- Remove-Item "${env:GITHUB_WORKSPACE}" -Recurse -WhatIf
+ CategoryInfo : InvalidOperation: (:) [Remove-Item], PSInvalidOperationException + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RemoveItemCommandRemove-Item : Cannot remove the item at 'C:\github_work\<repository name>' because it is in use.
At <path to>\sample_cleanup.ps1:5 char:1
- Remove-Item "${env:RUNNER_WORKSPACE}" -Recurse -WhatIf
+ CategoryInfo : InvalidOperation: (:) [Remove-Item], PSInvalidOperationException + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RemoveItemCommand