terraform-linters / setup-tflint

A GitHub action that installs Terraform linter TFLint
MIT License
142 stars 38 forks source link

Windows support: Handle when Expand-Archive refuses to extract file without .zip extension #166

Closed cpc-camarj closed 1 year ago

cpc-camarj commented 1 year ago

This is a workaround to handle the problem described here: https://github.com/actions/toolkit/issues/1287

bendrucker commented 1 year ago

Windows tests that reproduce this issue would be ideal! I can work on testing on Windows if needed.

bendrucker commented 1 year ago

See #168. I read https://github.com/actions/toolkit/issues/1287 more carefully. I'm disinclined to add a workaround here for @actions/* for a specific Windows self-hosted runner configuration. Especially for outdated versions. I don't know much about PowerShell but perhaps it would be possible to shim that command to do the renaming you want.

cpc-camarj commented 1 year ago

I looked into shimming, and it would be possible to workaround this problem with something like the following in a Powershell profile:

function Expand-Archive($path) { 
  if ( $path -NotMatch ".zip$" ){ 
    Move-Item "$path" "${path}.zip"
    powershell.exe -nop -c Expand-Archive "${path}.zip"
  } else {
    powershell -nop -c Expand-Archive $path
  }
}

we ultimately decided to go ahead and install Powershell Core by default on all our self-hosted runners.

cpc-camarj commented 1 year ago

since my team has landed on a different solution, I'll close the PR.