From dca49cf32dd9d8be6ba9f79759714ed3de0ba6ad Mon Sep 17 00:00:00 2001 From: Edwin Otten Date: Fri, 24 Nov 2023 10:39:41 +0100 Subject: [PATCH] Replace deprecated set-ouput command Write to GitHub environment file instead of using the deprecated `set-output` command. Following recommendations from https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b4969f8..8b7c851 100755 --- a/index.js +++ b/index.js @@ -3,7 +3,8 @@ const process = require("process"); const { join } = require("path"); const { spawn } = require("child_process"); -const { readFile } = require("fs"); +const { readFile, appendFileSync } = require("fs"); +const { EOL } = require("os"); async function main() { const dir = @@ -165,8 +166,8 @@ async function publishPackage(dir, config, version) { } function setOutput(name, value = "") { - const out = `name=${encodeURIComponent(name)}::${encodeURIComponent(value)}`; - console.log(`::set-output ${out}`); + const output = process.env['GITHUB_OUTPUT'] + appendFileSync(output, `${key}=${value}${EOL}`) } function run(cwd, command, ...args) {