mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-24 21:21:28 +00:00
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
|
"use strict";
|
||
|
// For internal use, subject to change.
|
||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||
|
if (mod && mod.__esModule) return mod;
|
||
|
var result = {};
|
||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||
|
result["default"] = mod;
|
||
|
return result;
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
// 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
|