Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tc.extractZip() failure due to tc.downloadTool() not adding .zip extension #1179

Open
rsenden opened this issue Sep 14, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@rsenden
Copy link

rsenden commented Sep 14, 2022

Describe the bug
If no destination is provided when calling tc.downloadTool(), this function defaults to <tempDir>/<uuidv4>. This creates a destination file that doesn't have any file extension, which can apparently cause a subsequent call to tc.extractZip() to fail, with an error like the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_temp\0f5cb3c0-ca78-43d2-9bf3-19b379b1f416' -DestinationPath 'C:\actions-runner\_work\_temp\882ce538-f7ae-45ef-adc9-32c2ee3cd5e1' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\_temp\0f5cb3c0-ca78-43d2-9bf3-19b379b1f416', 'C:\actions-runner\_work\_temp\882ce538-f7ae-45ef-adc9-32c2ee3cd5e1', $true) }"
Expand-Archive : is not a supported archive file format. .zip is the only supported archive file format.

Expected behavior
After downloading a proper zip-file with tc.downloadTool(), tc.extractZip() should run without any errors.

Either:

  • tc.downloadTool() should default to a destination file that has the same file extension as provided in the given url
  • tc.extractZip() should add a .zip extension if necessary
  • Both of the above
@rsenden
Copy link
Author

rsenden commented Sep 14, 2022

As someone else suggested, this issue might be related to the PowerShell version installed on the runner; supposedly PowerShell 7+ should be able to extract zip files without the proper .zip extension. Still, it might be good to implement one of the suggestions under Expected behavior to allow actions using these tool-cache functions to run properly on older PowerShell versions.

rsenden added a commit to fortify/gha-setup-scancentral-client that referenced this issue Sep 14, 2022
dzsquared added a commit to Azure/sql-action that referenced this issue Mar 10, 2023
forces a .zip extension on the downloaded item due to inconsistent windows behavior in unzipping files with no extension
upstream issue: actions/toolkit#1179
xHyroM added a commit to oven-sh/setup-bun that referenced this issue May 8, 2024
xHyroM added a commit to oven-sh/setup-bun that referenced this issue Jun 21, 2024
* feat: add input bun-version-file (#76)

* feat: add input for bun-version-file

* docs: update example bun version file

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* refactor: reduce read from file code

* [autofix.ci] apply automated fixes

* feat: read from all known files if not specified

* [autofix.ci] apply automated fixes

* fix: just continue if file doesnt exist

* [autofix.ci] apply automated fixes

* fix: return output if found version

* [autofix.ci] apply automated fixes

* fix: make whitespace in .tool-versions optional

* [autofix.ci] apply automated fixes

* log loglog

* [autofix.ci] apply automated fixes

* log log log

* [autofix.ci] apply automated fixes

* better warnings, fix ci failing

* [autofix.ci] apply automated fixes

* feat: log obtained version

* [autofix.ci] apply automated fixes

* build: bump version

* [autofix.ci] apply automated fixes

* fix: add .zip extension if it's not present

Workaround for actions/toolkit#1179

Fixes #79

* [autofix.ci] apply automated fixes

* docs: add comment for easier understanding

* ci: more readable version

* ci: match name

* docs: add package.json and .tool-versions to bun-version-file examples

* ci: add cache test

* ci: install another pkg for cache test

* ci: install more pkgs for cache test

* ci: block all trusted deps in cache test

* ci: more deps for cache test

* ci: cache test should cache

* refactor: dont try all files if not defined

* [autofix.ci] apply automated fixes

* ci: remove cache test

* feat: support .bunrc

* [autofix.ci] apply automated fixes

* refactor: .bun-version instead .bunrc

* [autofix.ci] apply automated fixes

* feat: add bun paths and url to output

Fixes #81

* [autofix.ci] apply automated fixes

* ci: test for .bun-version

* feat: make .bun-version as default in bun-version-file

* ci: remove cache before test

* ci: remove cache before test

* ci: remove cache before test

* ci: remove cache before test

---------

Co-authored-by: Ade Hery Shopyan <51158020+adeherysh@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant