diff --git a/dist/index.js b/dist/index.js
index a037c27..8cd6118 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -37,165 +37,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.run = void 0;
const core = __importStar(__nccwpck_require__(186));
-const http = __nccwpck_require__(605);
-const https = __nccwpck_require__(211);
-const q = __nccwpck_require__(172);
-const url = __nccwpck_require__(835);
-var emBaseURL = url.parse(core.getInput('ctpUrl'));
-if (emBaseURL.path === '/') {
- emBaseURL.path = '/em';
-}
-else if (emBaseURL.path === '/em/') {
- emBaseURL.path = '/em';
-}
-var protocol = emBaseURL.protocol === 'https:' ? https : http;
-var protocolLabel = emBaseURL.protocol || 'http:';
-var username = core.getInput('ctpUsername');
-var getFromEM = function (path) {
- var def = q.defer();
- var options = {
- host: emBaseURL.hostname,
- port: emBaseURL.port,
- path: emBaseURL.path + path,
- auth: undefined,
- headers: {
- 'Accept': 'application/json'
- }
- };
- if (protocolLabel === 'https:') {
- options['rejectUnauthorized'] = false;
- options['agent'] = false;
- }
- if (username) {
- options.auth = username + ':' + core.getInput('ctpPassword');
- }
- console.log('GET ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);
- var responseString = "";
- protocol.get(options, (res) => {
- res.setEncoding('utf8');
- res.on('data', (chunk) => {
- responseString += chunk;
- });
- res.on('end', () => {
- console.log(' response ' + res.statusCode + ': ' + responseString);
- var responseObject = JSON.parse(responseString);
- def.resolve(responseObject);
- });
- }).on('error', (e) => {
- def.reject(e);
- });
- return def.promise;
-};
-var findInEM = function (path, property, name) {
- var def = q.defer();
- var options = {
- host: emBaseURL.hostname,
- port: emBaseURL.port,
- path: emBaseURL.path + path,
- auth: undefined,
- headers: {
- 'Accept': 'application/json'
- }
- };
- if (protocolLabel === 'https:') {
- options['rejectUnauthorized'] = false;
- options['agent'] = false;
- }
- if (username) {
- options.auth = username + ':' + core.getInput('ctpPassword');
- }
- var responseString = "";
- console.log('GET ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);
- protocol.get(options, (res) => {
- res.setEncoding('utf8');
- res.on('data', (chunk) => {
- responseString += chunk;
- });
- res.on('end', () => {
- console.log(' response ' + res.statusCode + ': ' + responseString);
- var responseObject = JSON.parse(responseString);
- if (typeof responseObject[property] === 'undefined') {
- def.reject(property + ' does not exist in response object from ' + path);
- return;
- }
- for (var i = 0; i < responseObject[property].length; i++) {
- if (responseObject[property][i].name === name) {
- def.resolve(responseObject[property][i]);
- return;
- }
- }
- def.reject('Could not find name "' + name + '" in ' + property + ' from ' + path);
- return;
- });
- }).on('error', (e) => {
- def.reject(e);
- });
- return def.promise;
-};
-var postToEM = function (path, data) {
- var def = q.defer();
- var options = {
- host: emBaseURL.hostname,
- port: parseInt(emBaseURL.port),
- path: emBaseURL.path + path,
- method: 'POST',
- auth: undefined,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- }
- };
- if (protocolLabel === 'https:') {
- options['rejectUnauthorized'] = false;
- options['agent'] = false;
- }
- if (username) {
- options.auth = username + ':' + core.getInput('ctpPassword');
- }
- console.log('POST ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);
- var responseString = "";
- var req = protocol.request(options, (res) => {
- res.setEncoding('utf8');
- res.on('data', (chunk) => {
- responseString += chunk;
- });
- res.on('end', () => {
- console.log(' response ' + res.statusCode + ': ' + responseString);
- var responseObject = JSON.parse(responseString);
- def.resolve(responseObject);
- });
- }).on('error', (e) => {
- def.reject(e);
- });
- req.write(JSON.stringify(data));
- req.end();
- return def.promise;
-};
+const service = __importStar(__nccwpck_require__(511));
function run() {
return __awaiter(this, void 0, void 0, function* () {
- var systemName = core.getInput('system');
+ var ctpEndpoint = core.getInput('ctpUrl', { required: true });
+ var ctpUsername = core.getInput('ctpUsername', { required: true });
+ var ctpPassword = core.getInput('ctpPassword', { required: true });
+ var ctpService = new service.WebService(ctpEndpoint, 'em', { username: ctpUsername, password: ctpPassword });
+ var systemName = core.getInput('system', { required: true });
var systemId;
- var environmentName = core.getInput('environment');
+ var environmentName = core.getInput('environment', { required: true });
var environmentId;
- var instanceName = core.getInput('instance');
+ var instanceName = core.getInput('instance', { required: true });
var instanceId;
- var copyToVirtualize = core.getInput('copyToVirtualize');
- var duplicateDataRepo = core.getInput('duplicateDataRepo');
- var virtualizeName = core.getInput('virtServerName');
- var newEnvironmentName = core.getInput('newEnvironmentName');
+ var copyToVirtualize = core.getInput('copyToVirtualize', { required: false });
+ var duplicateDataRepo = core.getInput('duplicateDataRepo', { required: false });
+ var virtualizeName = core.getInput('virtServerName', { required: false });
+ var newEnvironmentName = core.getInput('newEnvironmentName', { required: false });
var virtualizeServerId;
- var instancesPromise = findInEM('/api/v2/systems', 'systems', systemName).then((system) => {
+ var instancesPromise = ctpService.findInEM('/api/v2/systems', 'systems', systemName).then((system) => {
core.debug('Found system ' + system.name + ' with id ' + system.id);
systemId = system.id;
- return findInEM('/api/v2/environments', 'environments', environmentName);
+ return ctpService.findInEM('/api/v2/environments', 'environments', environmentName);
}).then((environment) => {
environmentId = environment.id;
- return findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);
+ return ctpService.findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);
});
if (copyToVirtualize === 'true') {
instancesPromise = instancesPromise.then((instance) => {
- return findInEM('/api/v2/servers', 'servers', virtualizeName);
+ return ctpService.findInEM('/api/v2/servers', 'servers', virtualizeName);
}).then((server) => {
virtualizeServerId = server.id;
var duplicateType = core.getInput('duplicateType');
@@ -215,15 +87,15 @@ function run() {
copyEnv.dataRepoSettings = dataRepoSettings;
console.log("Data repo host: " + dataRepoSettings.host);
}
- return postToEM('/api/v2/environments/copy?async=false', copyEnv);
+ return ctpService.postToEM('/api/v2/environments/copy?async=false', copyEnv);
}).then((copyResult) => {
environmentId = copyResult.environmentId;
- return findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);
+ return ctpService.findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);
});
}
instancesPromise.then((instance) => {
instanceId = instance.id;
- return postToEM('/api/v2/provisions', {
+ return ctpService.postToEM('/api/v2/provisions', {
environmentId: environmentId,
instanceId: instanceId,
abortOnFailure: core.getInput('abortOnFailure') === 'true'
@@ -232,7 +104,7 @@ function run() {
var eventId = res.eventId;
var status = res.status;
var checkStatus = function () {
- getFromEM('/api/v2/provisions/' + eventId).then((res) => {
+ ctpService.getFromEM('/api/v2/provisions/' + eventId).then((res) => {
status = res.status;
if (status === 'running' || status === 'waiting') {
setTimeout(checkStatus, 1000);
@@ -259,9 +131,174 @@ function run() {
});
});
}
+exports.run = run;
run();
+/***/ }),
+
+/***/ 511:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.WebService = void 0;
+const http = __nccwpck_require__(605);
+const https = __nccwpck_require__(211);
+const q = __nccwpck_require__(172);
+const url = __nccwpck_require__(835);
+class WebService {
+ constructor(endpoint, context, authorization) {
+ this.baseURL = url.parse(endpoint);
+ if (this.baseURL.path === '/') {
+ this.baseURL.path += context;
+ }
+ else if (this.baseURL.path === `/${context}/`) {
+ this.baseURL.path = `/${context}`;
+ }
+ this.authorization = authorization;
+ this.protocol = this.baseURL.protocol === 'https:' ? https : http;
+ this.protocolLabel = this.baseURL.protocol || 'http:';
+ }
+ getFromEM(path) {
+ let def = q.defer();
+ let promise = new Promise((resolve, reject) => {
+ def.resolve = resolve;
+ def.reject = reject;
+ });
+ var options = {
+ host: this.baseURL.hostname,
+ port: this.baseURL.port,
+ path: this.baseURL.path + path,
+ auth: undefined,
+ headers: {
+ 'Accept': 'application/json'
+ }
+ };
+ if (this.protocolLabel === 'https:') {
+ options['rejectUnauthorized'] = false;
+ options['agent'] = false;
+ }
+ if (this.authorization) {
+ options.auth = this.authorization.username + ':' + this.authorization.password;
+ }
+ console.log('GET ' + this.protocolLabel + '//' + options.host + ':' + options.port + options.path);
+ var responseString = "";
+ this.protocol.get(options, (res) => {
+ res.setEncoding('utf8');
+ res.on('data', (chunk) => {
+ responseString += chunk;
+ });
+ res.on('end', () => {
+ console.log(' response ' + res.statusCode + ': ' + responseString);
+ var responseObject = JSON.parse(responseString);
+ def.resolve(responseObject);
+ });
+ }).on('error', (e) => {
+ def.reject(e);
+ });
+ return promise;
+ }
+ ;
+ findInEM(path, property, name) {
+ let def = q.defer();
+ let promise = new Promise((resolve, reject) => {
+ def.resolve = resolve;
+ def.reject = reject;
+ });
+ var options = {
+ host: this.baseURL.hostname,
+ port: this.baseURL.port,
+ path: this.baseURL.path + path,
+ auth: undefined,
+ headers: {
+ 'Accept': 'application/json'
+ }
+ };
+ if (this.protocolLabel === 'https:') {
+ options['rejectUnauthorized'] = false;
+ options['agent'] = false;
+ }
+ if (this.authorization) {
+ options.auth = this.authorization.username + ':' + this.authorization.password;
+ }
+ var responseString = "";
+ console.log('GET ' + this.protocolLabel + '//' + options.host + ':' + options.port + options.path);
+ this.protocol.get(options, (res) => {
+ res.setEncoding('utf8');
+ res.on('data', (chunk) => {
+ responseString += chunk;
+ });
+ res.on('end', () => {
+ console.log(' response ' + res.statusCode + ': ' + responseString);
+ var responseObject = JSON.parse(responseString);
+ if (typeof responseObject[property] === 'undefined') {
+ def.reject(property + ' does not exist in response object from ' + path);
+ return;
+ }
+ for (var i = 0; i < responseObject[property].length; i++) {
+ if (responseObject[property][i].name === name) {
+ def.resolve(responseObject[property][i]);
+ return;
+ }
+ }
+ def.reject('Could not find name "' + name + '" in ' + property + ' from ' + path);
+ return;
+ });
+ }).on('error', (e) => {
+ def.reject(e);
+ });
+ return promise;
+ }
+ ;
+ postToEM(path, data) {
+ let def = q.defer();
+ let promise = new Promise((resolve, reject) => {
+ def.resolve = resolve;
+ def.reject = reject;
+ });
+ var options = {
+ host: this.baseURL.hostname,
+ port: parseInt(this.baseURL.port),
+ path: this.baseURL.path + path,
+ method: 'POST',
+ auth: undefined,
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ }
+ };
+ if (this.protocolLabel === 'https:') {
+ options['rejectUnauthorized'] = false;
+ options['agent'] = false;
+ }
+ if (this.authorization) {
+ options.auth = this.authorization.username + ':' + this.authorization.password;
+ }
+ console.log('POST ' + this.protocolLabel + '//' + options.host + ':' + options.port + options.path);
+ var responseString = "";
+ var req = this.protocol.request(options, (res) => {
+ res.setEncoding('utf8');
+ res.on('data', (chunk) => {
+ responseString += chunk;
+ });
+ res.on('end', () => {
+ console.log(' response ' + res.statusCode + ': ' + responseString);
+ var responseObject = JSON.parse(responseString);
+ def.resolve(responseObject);
+ });
+ }).on('error', (e) => {
+ def.reject(e);
+ });
+ req.write(JSON.stringify(data));
+ req.end();
+ return promise;
+ }
+}
+exports.WebService = WebService;
+
+
/***/ }),
/***/ 351:
diff --git a/dist/index.js.map b/dist/index.js.map
index b951b84..7870062 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sources":["../webpack://deploy-environment-action/./lib/main.js","../webpack://deploy-environment-action/./node_modules/@actions/core/lib/command.js","../webpack://deploy-environment-action/./node_modules/@actions/core/lib/core.js","../webpack://deploy-environment-action/./node_modules/@actions/core/lib/file-command.js","../webpack://deploy-environment-action/./node_modules/@actions/core/lib/utils.js","../webpack://deploy-environment-action/./node_modules/q/q.js","../webpack://deploy-environment-action/external \"fs\"","../webpack://deploy-environment-action/external \"http\"","../webpack://deploy-environment-action/external \"https\"","../webpack://deploy-environment-action/external \"os\"","../webpack://deploy-environment-action/external \"path\"","../webpack://deploy-environment-action/external \"url\"","../webpack://deploy-environment-action/webpack/bootstrap","../webpack://deploy-environment-action/webpack/runtime/compat","../webpack://deploy-environment-action/webpack/startup"],"sourcesContent":["\"use strict\";\r\n/// \r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n});\r\nvar __importStar = (this && this.__importStar) || function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst core = __importStar(require(\"@actions/core\"));\r\nconst http = require(\"http\");\r\nconst https = require(\"https\");\r\nconst q = require(\"q\");\r\nconst url = require(\"url\");\r\nvar emBaseURL = url.parse(core.getInput('ctpUrl'));\r\nif (emBaseURL.path === '/') {\r\n emBaseURL.path = '/em';\r\n}\r\nelse if (emBaseURL.path === '/em/') {\r\n emBaseURL.path = '/em';\r\n}\r\nvar protocol = emBaseURL.protocol === 'https:' ? https : http;\r\nvar protocolLabel = emBaseURL.protocol || 'http:';\r\nvar username = core.getInput('ctpUsername');\r\nvar getFromEM = function (path) {\r\n var def = q.defer();\r\n var options = {\r\n host: emBaseURL.hostname,\r\n port: emBaseURL.port,\r\n path: emBaseURL.path + path,\r\n auth: undefined,\r\n headers: {\r\n 'Accept': 'application/json'\r\n }\r\n };\r\n if (protocolLabel === 'https:') {\r\n options['rejectUnauthorized'] = false;\r\n options['agent'] = false;\r\n }\r\n if (username) {\r\n options.auth = username + ':' + core.getInput('ctpPassword');\r\n }\r\n console.log('GET ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);\r\n var responseString = \"\";\r\n protocol.get(options, (res) => {\r\n res.setEncoding('utf8');\r\n res.on('data', (chunk) => {\r\n responseString += chunk;\r\n });\r\n res.on('end', () => {\r\n console.log(' response ' + res.statusCode + ': ' + responseString);\r\n var responseObject = JSON.parse(responseString);\r\n def.resolve(responseObject);\r\n });\r\n }).on('error', (e) => {\r\n def.reject(e);\r\n });\r\n return def.promise;\r\n};\r\nvar findInEM = function (path, property, name) {\r\n var def = q.defer();\r\n var options = {\r\n host: emBaseURL.hostname,\r\n port: emBaseURL.port,\r\n path: emBaseURL.path + path,\r\n auth: undefined,\r\n headers: {\r\n 'Accept': 'application/json'\r\n }\r\n };\r\n if (protocolLabel === 'https:') {\r\n options['rejectUnauthorized'] = false;\r\n options['agent'] = false;\r\n }\r\n if (username) {\r\n options.auth = username + ':' + core.getInput('ctpPassword');\r\n }\r\n var responseString = \"\";\r\n console.log('GET ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);\r\n protocol.get(options, (res) => {\r\n res.setEncoding('utf8');\r\n res.on('data', (chunk) => {\r\n responseString += chunk;\r\n });\r\n res.on('end', () => {\r\n console.log(' response ' + res.statusCode + ': ' + responseString);\r\n var responseObject = JSON.parse(responseString);\r\n if (typeof responseObject[property] === 'undefined') {\r\n def.reject(property + ' does not exist in response object from ' + path);\r\n return;\r\n }\r\n for (var i = 0; i < responseObject[property].length; i++) {\r\n if (responseObject[property][i].name === name) {\r\n def.resolve(responseObject[property][i]);\r\n return;\r\n }\r\n }\r\n def.reject('Could not find name \"' + name + '\" in ' + property + ' from ' + path);\r\n return;\r\n });\r\n }).on('error', (e) => {\r\n def.reject(e);\r\n });\r\n return def.promise;\r\n};\r\nvar postToEM = function (path, data) {\r\n var def = q.defer();\r\n var options = {\r\n host: emBaseURL.hostname,\r\n port: parseInt(emBaseURL.port),\r\n path: emBaseURL.path + path,\r\n method: 'POST',\r\n auth: undefined,\r\n headers: {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/json'\r\n }\r\n };\r\n if (protocolLabel === 'https:') {\r\n options['rejectUnauthorized'] = false;\r\n options['agent'] = false;\r\n }\r\n if (username) {\r\n options.auth = username + ':' + core.getInput('ctpPassword');\r\n }\r\n console.log('POST ' + protocolLabel + '//' + options.host + ':' + options.port + options.path);\r\n var responseString = \"\";\r\n var req = protocol.request(options, (res) => {\r\n res.setEncoding('utf8');\r\n res.on('data', (chunk) => {\r\n responseString += chunk;\r\n });\r\n res.on('end', () => {\r\n console.log(' response ' + res.statusCode + ': ' + responseString);\r\n var responseObject = JSON.parse(responseString);\r\n def.resolve(responseObject);\r\n });\r\n }).on('error', (e) => {\r\n def.reject(e);\r\n });\r\n req.write(JSON.stringify(data));\r\n req.end();\r\n return def.promise;\r\n};\r\nfunction run() {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n var systemName = core.getInput('system');\r\n var systemId;\r\n var environmentName = core.getInput('environment');\r\n var environmentId;\r\n var instanceName = core.getInput('instance');\r\n var instanceId;\r\n var copyToVirtualize = core.getInput('copyToVirtualize');\r\n var duplicateDataRepo = core.getInput('duplicateDataRepo');\r\n var virtualizeName = core.getInput('virtServerName');\r\n var newEnvironmentName = core.getInput('newEnvironmentName');\r\n var virtualizeServerId;\r\n var instancesPromise = findInEM('/api/v2/systems', 'systems', systemName).then((system) => {\r\n core.debug('Found system ' + system.name + ' with id ' + system.id);\r\n systemId = system.id;\r\n return findInEM('/api/v2/environments', 'environments', environmentName);\r\n }).then((environment) => {\r\n environmentId = environment.id;\r\n return findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);\r\n });\r\n if (copyToVirtualize === 'true') {\r\n instancesPromise = instancesPromise.then((instance) => {\r\n return findInEM('/api/v2/servers', 'servers', virtualizeName);\r\n }).then((server) => {\r\n virtualizeServerId = server.id;\r\n var duplicateType = core.getInput('duplicateType');\r\n var copyEnv = {\r\n originalEnvId: environmentId,\r\n serverId: virtualizeServerId,\r\n newEnvironmentName: newEnvironmentName,\r\n copyDataRepo: duplicateDataRepo\r\n };\r\n if (duplicateType === 'target' || duplicateType === 'custom') {\r\n var dataRepoSettings = {\r\n \"host\": duplicateType === 'target' ? server.host : core.getInput('repoHost'),\r\n \"port\": core.getInput('repoPort'),\r\n \"username\": core.getInput('repoUsername'),\r\n \"password\": core.getInput('repoPassword'),\r\n };\r\n copyEnv.dataRepoSettings = dataRepoSettings;\r\n console.log(\"Data repo host: \" + dataRepoSettings.host);\r\n }\r\n return postToEM('/api/v2/environments/copy?async=false', copyEnv);\r\n }).then((copyResult) => {\r\n environmentId = copyResult.environmentId;\r\n return findInEM('/api/v2/environments/' + environmentId + '/instances', 'instances', instanceName);\r\n });\r\n }\r\n instancesPromise.then((instance) => {\r\n instanceId = instance.id;\r\n return postToEM('/api/v2/provisions', {\r\n environmentId: environmentId,\r\n instanceId: instanceId,\r\n abortOnFailure: core.getInput('abortOnFailure') === 'true'\r\n });\r\n }).then((res) => {\r\n var eventId = res.eventId;\r\n var status = res.status;\r\n var checkStatus = function () {\r\n getFromEM('/api/v2/provisions/' + eventId).then((res) => {\r\n status = res.status;\r\n if (status === 'running' || status === 'waiting') {\r\n setTimeout(checkStatus, 1000);\r\n }\r\n else if (status === 'success') {\r\n core.debug('Successfully provisioned ' + core.getInput('instance'));\r\n }\r\n else if (status === 'canceled') {\r\n core.warning('Provisioning canceled.');\r\n }\r\n else {\r\n core.error('Provisioning failed with status: ' + status);\r\n if (core.getInput('abortOnFailure') === 'true') {\r\n core.setFailed('Provisioning failed with status: ' + status);\r\n }\r\n }\r\n });\r\n };\r\n if (status === 'running' || status === 'waiting') {\r\n setTimeout(checkStatus, 1000);\r\n }\r\n }).catch((e) => {\r\n core.setFailed(e.message);\r\n });\r\n });\r\n}\r\nrun();\r\n","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_';\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;\n file_command_1.issueCommand('ENV', commandValue);\n }\n else {\n command_1.issueCommand('set-env', { name }, convertedVal);\n }\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input. The value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n command_1.issueCommand('set-output', { name }, value);\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n */\nfunction error(message) {\n command_1.issue('error', message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds an warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n */\nfunction warning(message) {\n command_1.issue('warning', message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n command_1.issueCommand('save-state', { name }, value);\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\n//# sourceMappingURL=core.js.map","\"use strict\";\n// For internal use, subject to change.\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\nfunction issueCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueCommand = issueCommand;\n//# sourceMappingURL=file-command.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n//# sourceMappingURL=utils.js.map","// vim:ts=4:sts=4:sw=4:\n/*!\n *\n * Copyright 2009-2017 Kris Kowal under the terms of the MIT\n * license found at https://github.com/kriskowal/q/blob/v1/LICENSE\n *\n * With parts by Tyler Close\n * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found\n * at http://www.opensource.org/licenses/mit-license.html\n * Forked at ref_send.js version: 2009-05-11\n *\n * With parts by Mark Miller\n * Copyright (C) 2011 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n(function (definition) {\n \"use strict\";\n\n // This file will function properly as a