Write to GITHUB_ENV manually
This commit is contained in:
27
configure/dist/index.js
vendored
27
configure/dist/index.js
vendored
@@ -27555,8 +27555,13 @@ module.exports = parseParams
|
|||||||
/******/
|
/******/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
var __webpack_exports__ = {};
|
var __webpack_exports__ = {};
|
||||||
|
const fs = __nccwpck_require__(9896);
|
||||||
|
const os = __nccwpck_require__(857);
|
||||||
const core = __nccwpck_require__(7484);
|
const core = __nccwpck_require__(7484);
|
||||||
|
|
||||||
|
// configure manually appends env vars to GITHUB_ENV variable
|
||||||
|
// We cannot use `core.exportVariable` because it will set env var for the current process
|
||||||
|
// therefore those env vars will not be available for the next steps in the workflow
|
||||||
const configure = () => {
|
const configure = () => {
|
||||||
const OP_CONNECT_HOST =
|
const OP_CONNECT_HOST =
|
||||||
process.env.INPUT_CONNECT_HOST || process.env.OP_CONNECT_HOST;
|
process.env.INPUT_CONNECT_HOST || process.env.OP_CONNECT_HOST;
|
||||||
@@ -27565,18 +27570,24 @@ const configure = () => {
|
|||||||
const OP_SERVICE_ACCOUNT_TOKEN =
|
const OP_SERVICE_ACCOUNT_TOKEN =
|
||||||
process.env.INPUT_SERVICE_ACCOUNT_TOKEN ||
|
process.env.INPUT_SERVICE_ACCOUNT_TOKEN ||
|
||||||
process.env.SERVICE_ACCOUNT_TOKEN;
|
process.env.SERVICE_ACCOUNT_TOKEN;
|
||||||
|
const githubEnvPath = process.env["GITHUB_ENV"];
|
||||||
|
|
||||||
if (OP_CONNECT_HOST) {
|
if (!githubEnvPath) {
|
||||||
core.exportVariable("OP_CONNECT_HOST", OP_CONNECT_HOST);
|
core.setFailed("GITHUB_ENV is not defined");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OP_CONNECT_TOKEN) {
|
const setEnv = (key, value) => {
|
||||||
core.exportVariable("OP_CONNECT_TOKEN", OP_CONNECT_TOKEN);
|
if (value) {
|
||||||
}
|
fs.appendFileSync(githubEnvPath, `${key}=${value}${os.EOL}`, {
|
||||||
|
encoding: "utf8",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (OP_SERVICE_ACCOUNT_TOKEN) {
|
setEnv("OP_CONNECT_HOST", OP_CONNECT_HOST);
|
||||||
core.exportVariable("OP_SERVICE_ACCOUNT_TOKEN", OP_SERVICE_ACCOUNT_TOKEN);
|
setEnv("OP_CONNECT_TOKEN", OP_CONNECT_TOKEN);
|
||||||
}
|
setEnv("OP_SERVICE_ACCOUNT_TOKEN", OP_SERVICE_ACCOUNT_TOKEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const os = require("os");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
|
|
||||||
|
// configure manually appends env vars to GITHUB_ENV variable
|
||||||
|
// We cannot use `core.exportVariable` because it will set env var for the current process
|
||||||
|
// therefore those env vars will not be available for the next steps in the workflow
|
||||||
const configure = () => {
|
const configure = () => {
|
||||||
const OP_CONNECT_HOST =
|
const OP_CONNECT_HOST =
|
||||||
process.env.INPUT_CONNECT_HOST || process.env.OP_CONNECT_HOST;
|
process.env.INPUT_CONNECT_HOST || process.env.OP_CONNECT_HOST;
|
||||||
@@ -8,18 +13,24 @@ const configure = () => {
|
|||||||
const OP_SERVICE_ACCOUNT_TOKEN =
|
const OP_SERVICE_ACCOUNT_TOKEN =
|
||||||
process.env.INPUT_SERVICE_ACCOUNT_TOKEN ||
|
process.env.INPUT_SERVICE_ACCOUNT_TOKEN ||
|
||||||
process.env.SERVICE_ACCOUNT_TOKEN;
|
process.env.SERVICE_ACCOUNT_TOKEN;
|
||||||
|
const githubEnvPath = process.env["GITHUB_ENV"];
|
||||||
|
|
||||||
if (OP_CONNECT_HOST) {
|
if (!githubEnvPath) {
|
||||||
core.exportVariable("OP_CONNECT_HOST", OP_CONNECT_HOST);
|
core.setFailed("GITHUB_ENV is not defined");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OP_CONNECT_TOKEN) {
|
const setEnv = (key, value) => {
|
||||||
core.exportVariable("OP_CONNECT_TOKEN", OP_CONNECT_TOKEN);
|
if (value) {
|
||||||
}
|
fs.appendFileSync(githubEnvPath, `${key}=${value}${os.EOL}`, {
|
||||||
|
encoding: "utf8",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (OP_SERVICE_ACCOUNT_TOKEN) {
|
setEnv("OP_CONNECT_HOST", OP_CONNECT_HOST);
|
||||||
core.exportVariable("OP_SERVICE_ACCOUNT_TOKEN", OP_SERVICE_ACCOUNT_TOKEN);
|
setEnv("OP_CONNECT_TOKEN", OP_CONNECT_TOKEN);
|
||||||
}
|
setEnv("OP_SERVICE_ACCOUNT_TOKEN", OP_SERVICE_ACCOUNT_TOKEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
configure();
|
configure();
|
||||||
|
|||||||
Reference in New Issue
Block a user