From c9b6e6cd317634eab86b5b221ebb6e34c3926939 Mon Sep 17 00:00:00 2001 From: Shipra Kumari Date: Tue, 25 Nov 2025 18:56:25 +0530 Subject: [PATCH] Fix for BreakBuid Support on Windows --- dist/index.js | 14 +++++++++----- src/srcclr.ts | 9 +++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5900970..e5083d6 100755 --- a/dist/index.js +++ b/dist/index.js @@ -106618,7 +106618,7 @@ function runAction(options) { const commandOutput = options.createIssues ? `--json=${index_1.SCA_OUTPUT_FILE}` : ''; extraCommands = `${extraCommands}${options.recursive ? '--recursive ' : ''}${options.quick ? '--quick ' : ''}${options.allowDirty ? '--allow-dirty ' : ''}${options.updateAdvisor ? '--update-advisor ' : ''}${skipVMS ? '--skip-vms ' : ''}${noGraphs ? '--no-graphs ' : ''}${options.debug ? '--debug ' : ''}${skipCollectorsAttr}`; if (runnerOS == 'Windows') { - const powershellCommand = `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://sca-downloads.veracode.com/ci.ps1 -OutFile $env:TEMP\\ci.ps1; & $env:TEMP\\ci.ps1 -s -- scan ${extraCommands} ${commandOutput}"`; + const powershellCommand = `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://sca-downloads.veracode.com/ci.ps1 -OutFile $env:TEMP\\ci.ps1; & $env:TEMP\\ci.ps1 -s -- scan ${extraCommands} ${commandOutput}; exit $LASTEXITCODE"`; if (options.createIssues) { core.info('Starting the scan'); let output = ''; @@ -106630,8 +106630,9 @@ function runAction(options) { } } catch (error) { + console.log((error.stdout).toString()); if (error.status != null && error.status > 0 && (options.breakBuildOnPolicyFindings == 'true')) { - let summary_info = "Veraocde SCA Scan failed with exit code " + error.statuscode + "\n"; + let summary_info = "Veraocde SCA Scan failed with exit code " + error.status + "\n"; core.info(output); core.setFailed(summary_info); } @@ -106702,8 +106703,9 @@ function runAction(options) { core.info(output); } catch (error) { + console.log((error.stdout).toString()); if (error.status != null && error.status > 0 && (options.breakBuildOnPolicyFindings == 'true')) { - let summary_info = "Veraocde SCA Scan failed with exit code " + error.statuscode + "\n"; + let summary_info = "Veraocde SCA Scan failed with exit code " + error.status + "\n"; core.setFailed(summary_info); } } @@ -106821,7 +106823,8 @@ function runAction(options) { let pr_header = '
![](https://www.veracode.com/themes/veracode_new/library/img/veracode-black-hires.svg)
'; summary_message = `Veracode SCA Scan finished with exit code: ${code}. Please review created and linked issues`; try { - const octokit = github.getOctokit(options.github_token); + const baseUrl = process.env.GITHUB_API_URL || 'https://api.github.com'; + const octokit = github.getOctokit(options.github_token, { baseUrl }); const { data: comment } = yield octokit.rest.issues.createComment({ owner: repo[0], repo: repo[1], @@ -106947,7 +106950,8 @@ function runAction(options) { commentBody += output; //.replace(/ /g, '    '); commentBody += '

\n'; try { - const octokit = github.getOctokit(options.github_token); + const baseUrl = process.env.GITHUB_API_URL || 'https://api.github.com'; + const octokit = github.getOctokit(options.github_token, { baseUrl }); const { data: comment } = yield octokit.rest.issues.createComment({ owner: repo[0], repo: repo[1], diff --git a/src/srcclr.ts b/src/srcclr.ts index dabaae8..3cddd85 100644 --- a/src/srcclr.ts +++ b/src/srcclr.ts @@ -45,8 +45,7 @@ export async function runAction(options: Options) { extraCommands = `${extraCommands}${options.recursive ? '--recursive ' : ''}${options.quick ? '--quick ' : ''}${options.allowDirty ? '--allow-dirty ' : ''}${options.updateAdvisor ? '--update-advisor ' : ''}${skipVMS ? '--skip-vms ' : ''}${noGraphs ? '--no-graphs ' : ''}${options.debug ? '--debug ' : ''}${skipCollectorsAttr}`; if (runnerOS == 'Windows') { - const powershellCommand = `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://sca-downloads.veracode.com/ci.ps1 -OutFile $env:TEMP\\ci.ps1; & $env:TEMP\\ci.ps1 -s -- scan ${extraCommands} ${commandOutput}"` - + const powershellCommand = `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://sca-downloads.veracode.com/ci.ps1 -OutFile $env:TEMP\\ci.ps1; & $env:TEMP\\ci.ps1 -s -- scan ${extraCommands} ${commandOutput}; exit $LASTEXITCODE"` if (options.createIssues) { core.info('Starting the scan') let output: string = '' @@ -58,8 +57,9 @@ export async function runAction(options: Options) { } } catch (error: any) { + console.log((error.stdout).toString()) if (error.status != null && error.status > 0 && (options.breakBuildOnPolicyFindings == 'true')) { - let summary_info = "Veraocde SCA Scan failed with exit code " + error.statuscode + "\n" + let summary_info = "Veraocde SCA Scan failed with exit code " + error.status + "\n" core.info(output) core.setFailed(summary_info) } @@ -139,8 +139,9 @@ export async function runAction(options: Options) { core.info(output); } catch (error: any) { + console.log((error.stdout).toString()) if (error.status != null && error.status > 0 && (options.breakBuildOnPolicyFindings == 'true')) { - let summary_info = "Veraocde SCA Scan failed with exit code " + error.statuscode + "\n" + let summary_info = "Veraocde SCA Scan failed with exit code " + error.status + "\n" core.setFailed(summary_info) } }