mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2026-06-05 09:00:31 +03:00
SQSCANGHA-127 Rename downloaded file to .zip before extraction on Windows
PowerShell 5.1, used on some Windows GitHub Actions runners, requires Expand-Archive to receive a file with a .zip extension. The @actions/tool-cache downloadTool function saves to a temp path without any extension, causing extraction to fail on PS 5.1. Rename the file to add .zip before calling extractZip. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vendored
+13
-1
@@ -10,6 +10,7 @@ import { ok } from 'assert';
|
||||
import 'string_decoder';
|
||||
import * as events from 'events';
|
||||
import { setTimeout as setTimeout$1 } from 'timers';
|
||||
import * as fs$2 from 'node:fs/promises';
|
||||
import * as os$1 from 'node:os';
|
||||
import * as path$1 from 'node:path';
|
||||
import { join } from 'node:path';
|
||||
@@ -4141,6 +4142,15 @@ function cleanupGpgHome(gpgHome) {
|
||||
|
||||
const TOOLNAME = "sonar-scanner-cli";
|
||||
|
||||
async function ensureZipExtension(filePath) {
|
||||
if (filePath.endsWith(".zip")) {
|
||||
return filePath;
|
||||
}
|
||||
const zipPath = `${filePath}.zip`;
|
||||
await fs$2.rename(filePath, zipPath);
|
||||
return zipPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the Sonar Scanner CLI for the current environment and cache it.
|
||||
*/
|
||||
@@ -4188,7 +4198,9 @@ async function installSonarScanner({
|
||||
await verifySignature(downloadPath, signaturePath);
|
||||
}
|
||||
|
||||
const extractedPath = await extractZip(downloadPath);
|
||||
// PowerShell 5.1 (used on some Windows agents) requires the .zip extension for Expand-Archive
|
||||
const extractInput = await ensureZipExtension(downloadPath);
|
||||
const extractedPath = await extractZip(extractInput);
|
||||
|
||||
// Find the actual scanner directory inside the extracted folder
|
||||
const scannerPath = path$1.join(
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user