Prerequsite
- You are creating a JavaScript/TypeScript action for GitHub
- You already have a repository going. If not follow this tutorial.
Sauce
DIY
const fs = require('fs');
fs.appendFileSync(process.env["GITHUB_ENV"], "test_var=true");
Core method
const core = require('@actions/core');
core.exportVariable("test_var", "true")
Outcome
This also works for path & step summary :)
const fs = require("fs");
export function appendEnv(key, value) {
fs.appendFileSync(process.env["GITHUB_ENV"], `${key}=${value}`);
}
export function appendPath(path) {
fs.appendFileSync(process.env["GITHUB_PATH"], path);
}
export function appendStepSummary(content) {
fs.appendFileSync(process.env["GITHUB_STEP_SUMMARY"], content);
}
Latest comments (0)