neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
Swap to Environment Files
5849652 · Thomas Boop · 2020-09-29 14:38
Files changed
modified
dist/index.js
+84
−19
@@ -650,6 +650,32 @@ class ExecState extends events.EventEmitter {
| 650 | 650 | |
| 651 | 651 | /***/ }), |
| 652 | 652 | |
| 653 | +/***/ 82: | |
| 654 | +/***/ (function(__unusedmodule, exports) { | |
| 655 | + | |
| 656 | +"use strict"; | |
| 657 | + | |
| 658 | +// We use any as a valid input type | |
| 659 | +/* eslint-disable @typescript-eslint/no-explicit-any */ | |
| 660 | +Object.defineProperty(exports, "__esModule", { value: true }); | |
| 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 | + | |
| 653 | 679 | /***/ 87: |
| 654 | 680 | /***/ (function(module) { |
| 655 | 681 |
@@ -657,6 +683,42 @@ module.exports = require("os");
| 657 | 683 | |
| 658 | 684 | /***/ }), |
| 659 | 685 | |
| 686 | +/***/ 102: | |
| 687 | +/***/ (function(__unusedmodule, exports, __webpack_require__) { | |
| 688 | + | |
| 689 | +"use strict"; | |
| 690 | + | |
| 691 | +// For internal use, subject to change. | |
| 692 | +var __importStar = (this && this.__importStar) || function (mod) { | |
| 693 | + if (mod && mod.__esModule) return mod; | |
| 694 | + var result = {}; | |
| 695 | + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | |
| 696 | + result["default"] = mod; | |
| 697 | + return result; | |
| 698 | +}; | |
| 699 | +Object.defineProperty(exports, "__esModule", { value: true }); | |
| 700 | +// We use any as a valid input type | |
| 701 | +/* eslint-disable @typescript-eslint/no-explicit-any */ | |
| 702 | +const fs = __importStar(__webpack_require__(747)); | |
| 703 | +const os = __importStar(__webpack_require__(87)); | |
| 704 | +const utils_1 = __webpack_require__(82); | |
| 705 | +function issueCommand(command, message) { | |
| 706 | + const filePath = process.env[`GITHUB_${command}`]; | |
| 707 | + if (!filePath) { | |
| 708 | + throw new Error(`Unable to find environment variable for file command ${command}`); | |
| 709 | + } | |
| 710 | + if (!fs.existsSync(filePath)) { | |
| 711 | + throw new Error(`Missing file at path: ${filePath}`); | |
| 712 | + } | |
| 713 | + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { | |
| 714 | + encoding: 'utf8' | |
| 715 | + }); | |
| 716 | +} | |
| 717 | +exports.issueCommand = issueCommand; | |
| 718 | +//# sourceMappingURL=file-command.js.map | |
| 719 | + | |
| 720 | +/***/ }), | |
| 721 | + | |
| 660 | 722 | /***/ 129: |
| 661 | 723 | /***/ (function(module) { |
| 662 | 724 |
@@ -2794,6 +2856,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
| 2794 | 2856 | }; |
| 2795 | 2857 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 2796 | 2858 | const os = __importStar(__webpack_require__(87)); |
| 2859 | +const utils_1 = __webpack_require__(82); | |
| 2797 | 2860 | /** |
| 2798 | 2861 | * Commands |
| 2799 | 2862 | * |
@@ -2847,28 +2910,14 @@ class Command {
| 2847 | 2910 | return cmdStr; |
| 2848 | 2911 | } |
| 2849 | 2912 | } |
| 2850 | −/** | |
| 2851 | − * Sanitizes an input into a string so it can be passed into issueCommand safely | |
| 2852 | − * @param input input to sanitize into a string | |
| 2853 | − */ | |
| 2854 | −function toCommandValue(input) { | |
| 2855 | − if (input === null || input === undefined) { | |
| 2856 | − return ''; | |
| 2857 | − } | |
| 2858 | − else if (typeof input === 'string' || input instanceof String) { | |
| 2859 | − return input; | |
| 2860 | − } | |
| 2861 | − return JSON.stringify(input); | |
| 2862 | −} | |
| 2863 | −exports.toCommandValue = toCommandValue; | |
| 2864 | 2913 | function escapeData(s) { |
| 2865 | − return toCommandValue(s) | |
| 2914 | + return utils_1.toCommandValue(s) | |
| 2866 | 2915 | .replace(/%/g, '%25') |
| 2867 | 2916 | .replace(/\r/g, '%0D') |
| 2868 | 2917 | .replace(/\n/g, '%0A'); |
| 2869 | 2918 | } |
| 2870 | 2919 | function escapeProperty(s) { |
| 2871 | − return toCommandValue(s) | |
| 2920 | + return utils_1.toCommandValue(s) | |
| 2872 | 2921 | .replace(/%/g, '%25') |
| 2873 | 2922 | .replace(/\r/g, '%0D') |
| 2874 | 2923 | .replace(/\n/g, '%0A') |
@@ -2943,6 +2992,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
| 2943 | 2992 | }; |
| 2944 | 2993 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 2945 | 2994 | const command_1 = __webpack_require__(431); |
| 2995 | +const file_command_1 = __webpack_require__(102); | |
| 2996 | +const utils_1 = __webpack_require__(82); | |
| 2946 | 2997 | const os = __importStar(__webpack_require__(87)); |
| 2947 | 2998 | const path = __importStar(__webpack_require__(622)); |
| 2948 | 2999 | /** |
@@ -2969,9 +3020,17 @@ var ExitCode;
| 2969 | 3020 | */ |
| 2970 | 3021 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 2971 | 3022 | function exportVariable(name, val) { |
| 2972 | − const convertedVal = command_1.toCommandValue(val); | |
| 3023 | + const convertedVal = utils_1.toCommandValue(val); | |
| 2973 | 3024 | process.env[name] = convertedVal; |
| 2974 | − command_1.issueCommand('set-env', { name }, convertedVal); | |
| 3025 | + const filePath = process.env['GITHUB_ENV'] || ''; | |
| 3026 | + if (filePath) { | |
| 3027 | + const delimiter = '_GitHubActionsFileCommandDelimeter_'; | |
| 3028 | + const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; | |
| 3029 | + file_command_1.issueCommand('ENV', commandValue); | |
| 3030 | + } | |
| 3031 | + else { | |
| 3032 | + command_1.issueCommand('set-env', { name }, convertedVal); | |
| 3033 | + } | |
| 2975 | 3034 | } |
| 2976 | 3035 | exports.exportVariable = exportVariable; |
| 2977 | 3036 | /** |
@@ -2987,7 +3046,13 @@ exports.setSecret = setSecret;
| 2987 | 3046 | * @param inputPath |
| 2988 | 3047 | */ |
| 2989 | 3048 | function addPath(inputPath) { |
| 2990 | − command_1.issueCommand('add-path', {}, inputPath); | |
| 3049 | + const filePath = process.env['GITHUB_PATH'] || ''; | |
| 3050 | + if (filePath) { | |
| 3051 | + file_command_1.issueCommand('PATH', inputPath); | |
| 3052 | + } | |
| 3053 | + else { | |
| 3054 | + command_1.issueCommand('add-path', {}, inputPath); | |
| 3055 | + } | |
| 2991 | 3056 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; |
| 2992 | 3057 | } |
| 2993 | 3058 | exports.addPath = addPath; |
modified
dist/install-elixir
+1
−1
@@ -7,4 +7,4 @@ cd $RUNNER_TEMP
| 7 | 7 | wget -q https://repo.hex.pm/builds/elixir/${1}${2}.zip |
| 8 | 8 | unzip -d .setup-elixir/elixir ${1}${2}.zip |
| 9 | 9 | rm ${1}${2}.zip |
| 10 | −echo "::add-path::$(pwd)/.setup-elixir/elixir/bin" | |
| 10 | +echo "$(pwd)/.setup-elixir/elixir/bin" >> $GITHUB_PATH |
modified
dist/install-otp
+1
−1
@@ -9,4 +9,4 @@ mkdir -p .setup-elixir/otp
| 9 | 9 | tar zxf otp.tar.gz -C .setup-elixir/otp --strip-components=1 |
| 10 | 10 | rm otp.tar.gz |
| 11 | 11 | .setup-elixir/otp/Install -minimal $(pwd)/.setup-elixir/otp |
| 12 | −echo "::add-path::$(pwd)/.setup-elixir/otp/bin" | |
| 12 | +echo "$(pwd)/.setup-elixir/otp/bin" >> $GITHUB_PATH |
modified
package-lock.json
+3
−3
@@ -5,9 +5,9 @@
| 5 | 5 | "requires": true, |
| 6 | 6 | "dependencies": { |
| 7 | 7 | "@actions/core": { |
| 8 | − "version": "1.2.4", | |
| 9 | − "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", | |
| 10 | − "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" | |
| 8 | + "version": "1.2.6", | |
| 9 | + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", | |
| 10 | + "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" | |
| 11 | 11 | }, |
| 12 | 12 | "@actions/exec": { |
| 13 | 13 | "version": "1.0.4", |
modified
src/install-elixir
+1
−1
@@ -7,4 +7,4 @@ cd $RUNNER_TEMP
| 7 | 7 | wget -q https://repo.hex.pm/builds/elixir/${1}${2}.zip |
| 8 | 8 | unzip -d .setup-elixir/elixir ${1}${2}.zip |
| 9 | 9 | rm ${1}${2}.zip |
| 10 | −echo "::add-path::$(pwd)/.setup-elixir/elixir/bin" | |
| 10 | +echo "$(pwd)/.setup-elixir/elixir/bin" >> $GITHUB_PATH |
modified
src/install-otp
+1
−1
@@ -9,4 +9,4 @@ mkdir -p .setup-elixir/otp
| 9 | 9 | tar zxf otp.tar.gz -C .setup-elixir/otp --strip-components=1 |
| 10 | 10 | rm otp.tar.gz |
| 11 | 11 | .setup-elixir/otp/Install -minimal $(pwd)/.setup-elixir/otp |
| 12 | −echo "::add-path::$(pwd)/.setup-elixir/otp/bin" | |
| 12 | +echo "$(pwd)/.setup-elixir/otp/bin" >> $GITHUB_PATH |
Parents: 0899ea8