Skip to content

Commit

Permalink
enforce .zip extension on download item (#170)
Browse files Browse the repository at this point in the history
forces a .zip extension on the downloaded item due to inconsistent windows behavior in unzipping files with no extension
upstream issue: actions/toolkit#1179
  • Loading branch information
dzsquared authored Mar 10, 2023
1 parent 36c52fa commit 21f0f73
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/main.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
"azure-actions-webclient": "^1.0.3",
"glob": "^7.1.4",
"mssql": "^8.1.0",
"uuid": "^3.3.2",
"winreg": "^1.2.4"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^24.0.13",
"@types/mssql": "^8.0.0",
"@types/node": "^12.0.4",
"@types/uuid": "^3.4.4",
"@types/winreg": "^1.2.30",
"jest": "^29.1.1",
"jest-circus": "^24.7.1",
Expand Down
7 changes: 6 additions & 1 deletion src/Setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import * as core from '@actions/core';
import * as tc from '@actions/tool-cache';
import * as path from 'path';
import uuidV4 from 'uuid/v4';

export const sqlcmdToolName = 'go-sqlcmd';
export const sqlcmdVersion = '0.12.0';
Expand Down Expand Up @@ -36,7 +38,10 @@ export default class Setup {
return await tc.extractTar(downloadPath, undefined, 'xj');

case 'win32':
downloadPath = await tc.downloadTool(`https://github.com/microsoft/go-sqlcmd/releases/download/v${sqlcmdVersion}/sqlcmd-v${sqlcmdVersion}-windows-x64.zip`);
// forcing a .zip extension on the downloaded item due to inconsistent windows behavior in unzipping files with no extension
// upstream issue: https://github.com/actions/toolkit/issues/1179
const dest = path.join(process.env['RUNNER_TEMP'] || '', uuidV4()+'.zip');
downloadPath = await tc.downloadTool(`https://github.com/microsoft/go-sqlcmd/releases/download/v${sqlcmdVersion}/sqlcmd-v${sqlcmdVersion}-windows-x64.zip`, dest);
return await tc.extractZip(downloadPath);

default:
Expand Down

0 comments on commit 21f0f73

Please sign in to comment.