Skip to content

Commit

Permalink
use core.setOutput again #3481
Browse files Browse the repository at this point in the history
but with recent core library
  • Loading branch information
sven-dmlr committed Oct 30, 2024
1 parent 8872187 commit 2f4904d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
23 changes: 11 additions & 12 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 @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
18 changes: 9 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,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);
}

0 comments on commit 2f4904d

Please sign in to comment.