Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for set-output deprecation #1

Closed
paambaati opened this issue Oct 21, 2022 · 4 comments · Fixed by #2
Closed

Prepare for set-output deprecation #1

paambaati opened this issue Oct 21, 2022 · 4 comments · Fixed by #2
Labels

Comments

@paambaati
Copy link

set-output is being deprecated, see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

The fix is to either manually write to $GITHUB_OUTPUT yourself, or better, use the setOutput method in [@actions/core](https://www.npmjs.com/package/@actions/core).

@paambaati
Copy link
Author

paambaati commented Oct 21, 2022

I cooked up a fix, but I would strongly urge you to include the @actions/core package instead to do this –

diff --git a/index.js b/index.js
index 2bb3e36..62d5ca9 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,16 @@
+const { v4: uuidv4 } = require("uuid");
+const { EOL } = require("os");
+const { appendFileSync } = require("fs");
+
 function setOutput(name, value, stdout) {
-  stdout.write(`::set-output name=${name}::${value}\n`);
+  const filePath = process.env["GITHUB_OUTPUT"];
+  if (filePath) {
+    const delimiter = "ghadelimiter_" + uuidv4();
+    const output  = name + "<<" + delimiter + EOL + value + EOL + delimiter + EOL;
+    appendFileSync(filePath, output);
+  } else {
+    stdout.write(`::set-output name=${name}::${value}\n`);
+  }
 }
 
 function verifyConditions(_pluginConfig, { stdout }) {

I'm unsure of how to add dependencies to a semantic-release plugin, but I trust you can find this useful for a fix.

@felipecrs
Copy link
Owner

Thanks a lot for the heads up, I will use the actions/core method instead.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants