2021-02-08 12:58:32 +08:00
|
|
|
"use strict";
|
|
|
|
// For internal use, subject to change.
|
2021-06-04 22:19:14 +08:00
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
o[k2] = m[k];
|
|
|
|
}));
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
}) : function(o, v) {
|
|
|
|
o["default"] = v;
|
|
|
|
});
|
2021-02-08 12:58:32 +08:00
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
2021-06-04 22:19:14 +08:00
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
__setModuleDefault(result, mod);
|
2021-02-08 12:58:32 +08:00
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-06-04 22:19:14 +08:00
|
|
|
exports.issueCommand = void 0;
|
2021-02-08 12:58:32 +08:00
|
|
|
// We use any as a valid input type
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
const fs = __importStar(require("fs"));
|
|
|
|
const os = __importStar(require("os"));
|
|
|
|
const utils_1 = require("./utils");
|
|
|
|
function issueCommand(command, message) {
|
|
|
|
const filePath = process.env[`GITHUB_${command}`];
|
|
|
|
if (!filePath) {
|
|
|
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
|
|
|
}
|
|
|
|
if (!fs.existsSync(filePath)) {
|
|
|
|
throw new Error(`Missing file at path: ${filePath}`);
|
|
|
|
}
|
|
|
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
|
|
|
encoding: 'utf8'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.issueCommand = issueCommand;
|
|
|
|
//# sourceMappingURL=file-command.js.map
|