From 2f4904d26a68eded22e1924f80ab61b318e276c5 Mon Sep 17 00:00:00 2001 From: Sven Dolderer Date: Wed, 30 Oct 2024 10:18:42 +0100 Subject: [PATCH] use core.setOutput again #3481 but with recent core library --- github-actions/scan/dist/index.js | 23 +++++++++++------------ github-actions/scan/src/post-scan.ts | 18 +++++++++--------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/github-actions/scan/dist/index.js b/github-actions/scan/dist/index.js index c902f39d8..7d3d92d1f 100644 --- a/github-actions/scan/dist/index.js +++ b/github-actions/scan/dist/index.js @@ -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 @@ -29163,7 +29161,6 @@ function getFieldFromJson(field, jsonData) { - const NEW_LINE_SEPARATOR = '\n'; /** * Collect all necessary report data, downloads additional report formats (e.g. 'html') if necessary @@ -29388,15 +29385,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 (!external_fs_.existsSync(filePath)) { - throw new Error(`No access to file ${filePath}`); - } - external_fs_.appendFileSync(filePath, `${field}=${valuestring}${external_os_.EOL}`); - // core.setOutput(field, value.toString()); // Ensure value is converted to a string as GitHub Actions expects output variables to be strings. + // 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); } ;// CONCATENATED MODULE: ./src/projectname-resolver.ts @@ -29433,6 +29430,8 @@ function projectname_resolver_asJsonObject(text) { } } +// EXTERNAL MODULE: external "os" +var external_os_ = __nccwpck_require__(2037); ;// CONCATENATED MODULE: ./src/platform-helper.ts function getPlatform() { diff --git a/github-actions/scan/src/post-scan.ts b/github-actions/scan/src/post-scan.ts index ebf2a120b..68d15b5ff 100644 --- a/github-actions/scan/src/post-scan.ts +++ b/github-actions/scan/src/post-scan.ts @@ -283,13 +283,13 @@ 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, value.toString()); // Ensure value is converted to a string as GitHub Actions expects output variables to be strings. + // 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); }