Skip to content

Commit

Permalink
use fs.appendFileSync #3481
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-dmlr committed Dec 16, 2024
1 parent 2f4904d commit 0c8cc1d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
23 changes: 12 additions & 11 deletions github-actions/scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28990,6 +28990,8 @@ 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 @@ -29161,6 +29163,7 @@ function getFieldFromJson(field, jsonData) {




const NEW_LINE_SEPARATOR = '\n';
/**
* Collect all necessary report data, downloads additional report formats (e.g. 'html') if necessary
Expand Down Expand Up @@ -29385,15 +29388,15 @@ function setOutput(field, value, dataFormat) {
value = value !== null && value !== void 0 ? value : (dataFormat === 'number' ? 0 : 'FAILURE');
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 (!fs.existsSync(filePath)) {
// throw new Error(`No access to file ${filePath}`);
// }
// fs.appendFileSync(filePath, `${field}=${valuestring}${os.EOL}`);
core.setOutput(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}`);
// core.setOutput(field, valuestring);
}

;// CONCATENATED MODULE: ./src/projectname-resolver.ts
Expand Down Expand Up @@ -29430,8 +29433,6 @@ 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
14 changes: 7 additions & 7 deletions github-actions/scan/package-lock.json

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

19 changes: 10 additions & 9 deletions github-actions/scan/src/post-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,14 @@ 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}`);
core.setOutput(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}`);

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

0 comments on commit 0c8cc1d

Please sign in to comment.