Skip to content

Commit

Permalink
use execSync #3481
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-dmlr committed Dec 16, 2024
1 parent 0c8cc1d commit d6d7c7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
20 changes: 11 additions & 9 deletions github-actions/scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28990,8 +28990,6 @@ function ensureJsonReportAtBeginning(reportFormats) {

// EXTERNAL MODULE: ./node_modules/@actions/artifact/lib/artifact-client.js
var artifact_client = __nccwpck_require__(2605);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(2081);
;// CONCATENATED MODULE: ./src/shell-arg-sanitizer.ts
Expand Down Expand Up @@ -29389,13 +29387,15 @@ function setOutput(field, value, dataFormat) {
let valuestring = value.toString();
core.debug(`Output ${field}=${valuestring}`);
const filePath = process.env[`GITHUB_OUTPUT`];
if (!filePath) {
throw new Error(`Empty environment variable GITHUB_OUTPUT`);
}
if (!external_fs_.existsSync(filePath)) {
throw new Error(`No access to file ${filePath}`);
}
external_fs_.appendFileSync(filePath, `${field}=${valuestring}${external_os_.EOL}`);
const result = (0,external_child_process_.execSync)('echo "sven=Hello" >> "$GITHUB_OUTPUT"').toString();
console.log(result);
// if (!filePath) {
// throw new Error(`Empty environment variable GITHUB_OUTPUT`);
// }
// if (!fs.existsSync(filePath)) {
// throw new Error(`No access to file ${filePath}`);
// }
// fs.appendFileSync(filePath, `${field}=${valuestring}${os.EOL}`);
// core.setOutput(field, valuestring);
}

Expand Down Expand Up @@ -29433,6 +29433,8 @@ function projectname_resolver_asJsonObject(text) {
}
}

// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(2037);
;// CONCATENATED MODULE: ./src/platform-helper.ts

function getPlatform() {
Expand Down
17 changes: 10 additions & 7 deletions github-actions/scan/src/post-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { logExitCode } from './exitcode';
import { getReport } from './sechub-cli';
import { getFieldFromJson } from './json-helper';
import { execFileSync } from "child_process";
import { execSync } from 'child_process';
import { sanitize } from "./shell-arg-sanitizer";

const NEW_LINE_SEPARATOR = '\n';
Expand Down Expand Up @@ -284,13 +285,15 @@ function setOutput(field: string, value: any, dataFormat: string) {
core.debug(`Output ${field}=${valuestring}`);

const filePath = process.env[`GITHUB_OUTPUT`];
if (!filePath) {
throw new Error(`Empty environment variable GITHUB_OUTPUT`);
}
if (!fs.existsSync(filePath)) {
throw new Error(`No access to file ${filePath}`);
}
fs.appendFileSync(filePath, `${field}=${valuestring}${os.EOL}`);
const result = execSync('echo "sven=Hello" >> "$GITHUB_OUTPUT"').toString();
console.log(result);
// if (!filePath) {
// throw new Error(`Empty environment variable GITHUB_OUTPUT`);
// }
// if (!fs.existsSync(filePath)) {
// throw new Error(`No access to file ${filePath}`);
// }
// fs.appendFileSync(filePath, `${field}=${valuestring}${os.EOL}`);

// core.setOutput(field, valuestring);
}

0 comments on commit d6d7c7d

Please sign in to comment.