From d082b37cc81a24d71d82e67133354d3bd3f002d8 Mon Sep 17 00:00:00 2001 From: platane Date: Fri, 12 Jan 2024 13:05:17 +0100 Subject: [PATCH] . --- github-action.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/github-action.js b/github-action.js index 8f65b15..c6c7598 100644 --- a/github-action.js +++ b/github-action.js @@ -1,12 +1,20 @@ const fs = require("fs"); +const os = require("os"); const { execSync } = require("child_process"); const getInput = (name) => process.env[`INPUT_${name.toUpperCase()}`]; const getState = (name) => process.env[`STATE_${name}`] || ""; -const setState = (name, value) => - execSync(`echo "${name}=${value.toString()}" >> $GITHUB_STATE`); +const setState = (name, value) => { + const delimiter = `ghadelimiter_${Math.random().toString()}`; + + fs.appendFileSync( + "$GITHUB_STATE", + `${name}<<${delimiter}${os.EOL}${value}${os.EOL}${delimiter}${os.EOL}`, + { encoding: "utf8" } + ); +}; const setOutput = (name, value) => execSync(`echo "${name}=${value.toString()}" >> $GITHUB_OUTPUT`);