Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Jan 12, 2024
1 parent d246bbd commit d082b37
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions github-action.js
Original file line number Diff line number Diff line change
@@ -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`);
Expand Down

0 comments on commit d082b37

Please sign in to comment.