Skip to content

Commit 80213c4

Browse files
authored
Merge pull request #13 from byu-oit/v1
V1
2 parents bd28f7a + 21bb929 commit 80213c4

File tree

3 files changed

+168
-35
lines changed

3 files changed

+168
-35
lines changed

dist/index.js

Lines changed: 163 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,33 @@ module.exports = {"version":"2.0","metadata":{"apiVersion":"2014-06-30","endpoin
649649

650650
/***/ }),
651651

652+
/***/ 82:
653+
/***/ (function(__unusedmodule, exports) {
654+
655+
"use strict";
656+
657+
// We use any as a valid input type
658+
/* eslint-disable @typescript-eslint/no-explicit-any */
659+
Object.defineProperty(exports, "__esModule", { value: true });
660+
exports.toCommandValue = void 0;
661+
/**
662+
* Sanitizes an input into a string so it can be passed into issueCommand safely
663+
* @param input input to sanitize into a string
664+
*/
665+
function toCommandValue(input) {
666+
if (input === null || input === undefined) {
667+
return '';
668+
}
669+
else if (typeof input === 'string' || input instanceof String) {
670+
return input;
671+
}
672+
return JSON.stringify(input);
673+
}
674+
exports.toCommandValue = toCommandValue;
675+
//# sourceMappingURL=utils.js.map
676+
677+
/***/ }),
678+
652679
/***/ 86:
653680
/***/ (function(module, __unusedexports, __webpack_require__) {
654681

@@ -772,6 +799,55 @@ module.exports = require("os");
772799

773800
/***/ }),
774801

802+
/***/ 102:
803+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
804+
805+
"use strict";
806+
807+
// For internal use, subject to change.
808+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
809+
if (k2 === undefined) k2 = k;
810+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
811+
}) : (function(o, m, k, k2) {
812+
if (k2 === undefined) k2 = k;
813+
o[k2] = m[k];
814+
}));
815+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
816+
Object.defineProperty(o, "default", { enumerable: true, value: v });
817+
}) : function(o, v) {
818+
o["default"] = v;
819+
});
820+
var __importStar = (this && this.__importStar) || function (mod) {
821+
if (mod && mod.__esModule) return mod;
822+
var result = {};
823+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
824+
__setModuleDefault(result, mod);
825+
return result;
826+
};
827+
Object.defineProperty(exports, "__esModule", { value: true });
828+
exports.issueCommand = void 0;
829+
// We use any as a valid input type
830+
/* eslint-disable @typescript-eslint/no-explicit-any */
831+
const fs = __importStar(__webpack_require__(747));
832+
const os = __importStar(__webpack_require__(87));
833+
const utils_1 = __webpack_require__(82);
834+
function issueCommand(command, message) {
835+
const filePath = process.env[`GITHUB_${command}`];
836+
if (!filePath) {
837+
throw new Error(`Unable to find environment variable for file command ${command}`);
838+
}
839+
if (!fs.existsSync(filePath)) {
840+
throw new Error(`Missing file at path: ${filePath}`);
841+
}
842+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
843+
encoding: 'utf8'
844+
});
845+
}
846+
exports.issueCommand = issueCommand;
847+
//# sourceMappingURL=file-command.js.map
848+
849+
/***/ }),
850+
775851
/***/ 103:
776852
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
777853

@@ -4516,15 +4592,29 @@ AWS.RemoteCredentials = AWS.util.inherit(AWS.Credentials, {
45164592

45174593
"use strict";
45184594

4595+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4596+
if (k2 === undefined) k2 = k;
4597+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4598+
}) : (function(o, m, k, k2) {
4599+
if (k2 === undefined) k2 = k;
4600+
o[k2] = m[k];
4601+
}));
4602+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
4603+
Object.defineProperty(o, "default", { enumerable: true, value: v });
4604+
}) : function(o, v) {
4605+
o["default"] = v;
4606+
});
45194607
var __importStar = (this && this.__importStar) || function (mod) {
45204608
if (mod && mod.__esModule) return mod;
45214609
var result = {};
4522-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4523-
result["default"] = mod;
4610+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
4611+
__setModuleDefault(result, mod);
45244612
return result;
45254613
};
45264614
Object.defineProperty(exports, "__esModule", { value: true });
4615+
exports.issue = exports.issueCommand = void 0;
45274616
const os = __importStar(__webpack_require__(87));
4617+
const utils_1 = __webpack_require__(82);
45284618
/**
45294619
* Commands
45304620
*
@@ -4578,28 +4668,14 @@ class Command {
45784668
return cmdStr;
45794669
}
45804670
}
4581-
/**
4582-
* Sanitizes an input into a string so it can be passed into issueCommand safely
4583-
* @param input input to sanitize into a string
4584-
*/
4585-
function toCommandValue(input) {
4586-
if (input === null || input === undefined) {
4587-
return '';
4588-
}
4589-
else if (typeof input === 'string' || input instanceof String) {
4590-
return input;
4591-
}
4592-
return JSON.stringify(input);
4593-
}
4594-
exports.toCommandValue = toCommandValue;
45954671
function escapeData(s) {
4596-
return toCommandValue(s)
4672+
return utils_1.toCommandValue(s)
45974673
.replace(/%/g, '%25')
45984674
.replace(/\r/g, '%0D')
45994675
.replace(/\n/g, '%0A');
46004676
}
46014677
function escapeProperty(s) {
4602-
return toCommandValue(s)
4678+
return utils_1.toCommandValue(s)
46034679
.replace(/%/g, '%25')
46044680
.replace(/\r/g, '%0D')
46054681
.replace(/\n/g, '%0A')
@@ -5898,6 +5974,25 @@ AWS.util.mixin(AWS.Request, AWS.SequentialExecutor);
58985974

58995975
"use strict";
59005976

5977+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5978+
if (k2 === undefined) k2 = k;
5979+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5980+
}) : (function(o, m, k, k2) {
5981+
if (k2 === undefined) k2 = k;
5982+
o[k2] = m[k];
5983+
}));
5984+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5985+
Object.defineProperty(o, "default", { enumerable: true, value: v });
5986+
}) : function(o, v) {
5987+
o["default"] = v;
5988+
});
5989+
var __importStar = (this && this.__importStar) || function (mod) {
5990+
if (mod && mod.__esModule) return mod;
5991+
var result = {};
5992+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5993+
__setModuleDefault(result, mod);
5994+
return result;
5995+
};
59015996
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
59025997
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59035998
return new (P || (P = Promise))(function (resolve, reject) {
@@ -5907,15 +6002,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59076002
step((generator = generator.apply(thisArg, _arguments || [])).next());
59086003
});
59096004
};
5910-
var __importStar = (this && this.__importStar) || function (mod) {
5911-
if (mod && mod.__esModule) return mod;
5912-
var result = {};
5913-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
5914-
result["default"] = mod;
5915-
return result;
5916-
};
59176005
Object.defineProperty(exports, "__esModule", { value: true });
6006+
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
59186007
const command_1 = __webpack_require__(431);
6008+
const file_command_1 = __webpack_require__(102);
6009+
const utils_1 = __webpack_require__(82);
59196010
const os = __importStar(__webpack_require__(87));
59206011
const path = __importStar(__webpack_require__(622));
59216012
/**
@@ -5942,9 +6033,17 @@ var ExitCode;
59426033
*/
59436034
// eslint-disable-next-line @typescript-eslint/no-explicit-any
59446035
function exportVariable(name, val) {
5945-
const convertedVal = command_1.toCommandValue(val);
6036+
const convertedVal = utils_1.toCommandValue(val);
59466037
process.env[name] = convertedVal;
5947-
command_1.issueCommand('set-env', { name }, convertedVal);
6038+
const filePath = process.env['GITHUB_ENV'] || '';
6039+
if (filePath) {
6040+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
6041+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
6042+
file_command_1.issueCommand('ENV', commandValue);
6043+
}
6044+
else {
6045+
command_1.issueCommand('set-env', { name }, convertedVal);
6046+
}
59486047
}
59496048
exports.exportVariable = exportVariable;
59506049
/**
@@ -5960,12 +6059,20 @@ exports.setSecret = setSecret;
59606059
* @param inputPath
59616060
*/
59626061
function addPath(inputPath) {
5963-
command_1.issueCommand('add-path', {}, inputPath);
6062+
const filePath = process.env['GITHUB_PATH'] || '';
6063+
if (filePath) {
6064+
file_command_1.issueCommand('PATH', inputPath);
6065+
}
6066+
else {
6067+
command_1.issueCommand('add-path', {}, inputPath);
6068+
}
59646069
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
59656070
}
59666071
exports.addPath = addPath;
59676072
/**
5968-
* Gets the value of an input. The value is also trimmed.
6073+
* Gets the value of an input.
6074+
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
6075+
* Returns an empty string if the value is not defined.
59696076
*
59706077
* @param name name of the input to get
59716078
* @param options optional. See InputOptions.
@@ -5976,9 +6083,34 @@ function getInput(name, options) {
59766083
if (options && options.required && !val) {
59776084
throw new Error(`Input required and not supplied: ${name}`);
59786085
}
6086+
if (options && options.trimWhitespace === false) {
6087+
return val;
6088+
}
59796089
return val.trim();
59806090
}
59816091
exports.getInput = getInput;
6092+
/**
6093+
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
6094+
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
6095+
* The return value is also in boolean type.
6096+
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
6097+
*
6098+
* @param name name of the input to get
6099+
* @param options optional. See InputOptions.
6100+
* @returns boolean
6101+
*/
6102+
function getBooleanInput(name, options) {
6103+
const trueValue = ['true', 'True', 'TRUE'];
6104+
const falseValue = ['false', 'False', 'FALSE'];
6105+
const val = getInput(name, options);
6106+
if (trueValue.includes(val))
6107+
return true;
6108+
if (falseValue.includes(val))
6109+
return false;
6110+
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
6111+
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
6112+
}
6113+
exports.getBooleanInput = getBooleanInput;
59826114
/**
59836115
* Sets the value of an output.
59846116
*
@@ -5987,6 +6119,7 @@ exports.getInput = getInput;
59876119
*/
59886120
// eslint-disable-next-line @typescript-eslint/no-explicit-any
59896121
function setOutput(name, value) {
6122+
process.stdout.write(os.EOL);
59906123
command_1.issueCommand('set-output', { name }, value);
59916124
}
59926125
exports.setOutput = setOutput;
@@ -20835,4 +20968,4 @@ module.exports = {
2083520968

2083620969
/***/ })
2083720970

20838-
/******/ });
20971+
/******/ });

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"author": "Scott Hutchings",
1616
"license": "Apache-2.0",
1717
"dependencies": {
18-
"@actions/core": "^1.2.4",
18+
"@actions/core": "^1.2.6",
1919
"aws-sdk": "^2.677.0"
2020
},
2121
"devDependencies": {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# yarn lockfile v1
33

44

5-
"@actions/core@^1.2.4":
6-
version "1.2.4"
7-
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab"
8-
integrity sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==
5+
"@actions/core@^1.2.6":
6+
version "1.3.0"
7+
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.3.0.tgz#f5e4b24c889e7f2e58b466cc8c7481292284eba0"
8+
integrity sha512-xxtX0Cwdhb8LcgatfJkokqT8KzPvcIbwL9xpLU09nOwBzaStbfm0dNncsP0M4us+EpoPdWy7vbzU5vSOH7K6pg==
99

1010
"@ardatan/[email protected]":
1111
version "0.0.1"

0 commit comments

Comments
 (0)