diff --git a/.github/workflows/setup-stackql-test.yml b/.github/workflows/setup-stackql-test.yml new file mode 100644 index 0000000..b9e2935 --- /dev/null +++ b/.github/workflows/setup-stackql-test.yml @@ -0,0 +1,57 @@ +name: 'setup stackql test' + +on: + push: + branches: + - main + - 'develop-**' + pull_request: + +defaults: + run: + shell: bash + +jobs: + stackql-test-matrix: + name: Stackql local run on ${{ matrix.os }} ${{ matrix.use_wrapper && 'with' || 'without' }} wrapper + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + use_wrapper: [true, false] + + steps: + - name: Checkout + uses: actions/checkout@v4.1.4 + + - name: Setup Stackql + uses: ./ + with: + use_wrapper: ${{matrix.use_wrapper}} + + - name: Get Stackql Version + id: get-stackql-version + run: | + echo "stackql_version<> $GITHUB_ENV + stackql --version >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Validate Stackql Version + run: | + # Extract only the relevant line containing version information + VERSION_OUTPUT=$(echo "${{ env.stackql_version }}" | grep -E 'stackql v[0-9]+\.[0-9]+\.[0-9]+') + echo "Version output: $VERSION_OUTPUT" + + SEMVER_REGEX="v[0-9]+\.[0-9]+\.[0-9]+" + PLATFORM_REGEX="(Linux|Darwin|Windows|Homebrew)" + + if ! [[ "$VERSION_OUTPUT" =~ $SEMVER_REGEX ]]; then + echo "Semantic version does not match expected format" + exit 1 + fi + if ! [[ "$VERSION_OUTPUT" =~ $PLATFORM_REGEX ]]; then + echo "Platform information does not match expected formats" + exit 1 + fi + + echo "version output validated successfully." \ No newline at end of file diff --git a/.github/workflows/setup-stackql.yml b/.github/workflows/setup-stackql.yml deleted file mode 100644 index 696436d..0000000 --- a/.github/workflows/setup-stackql.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: 'Setup StackQL' - -on: - push: - branches: - - main - - 'develop-**' - pull_request: - -defaults: - run: - shell: bash - -jobs: - stackql-test-matrix: - name: Stackql local run on ${{ matrix.os }} ${{ matrix.use_wrapper && 'with' || 'without' }} wrapper - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - use_wrapper: [true, false] - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Stackql - uses: ./ - with: - use_wrapper: ${{matrix.use_wrapper}} - - - name: Validate Stackql Version - run: | - stackql --version - - - name: Use GitHub Provider - run: | - stackql exec -i ./examples/github-example.iql - env: - STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }} - STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }} - - - name: Use Google Provider - run: | - stackql exec -i ./examples/google-example.iql - env: - GOOGLE_CREDENTIALS : ${{ secrets.GOOGLE_CREDENTIALS }} - - - name: Handle error - if: ${{ matrix.use_wrapper}} - continue-on-error: true - run: | ## specify a query file that doesnt exist - stackql exec -i ./examples/does-not-exist.iql diff --git a/README.md b/README.md index b4182ef..1b02224 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Setup StackQL](https://github.com/stackql/setup-stackql/actions/workflows/setup-stackql.yml/badge.svg)](https://github.com/stackql/setup-stackql/actions/workflows/setup-stackql.yml) +[![Setup StackQL](https://github.com/stackql/setup-stackql/actions/workflows/setup-stackql-test.yml/badge.svg)](https://github.com/stackql/setup-stackql/actions/workflows/setup-stackql-test.yml) # setup-stackql @@ -13,11 +13,11 @@ Authentication to StackQL providers is done via environment variables source fro The following example demonstrate the use of the `stackql/setup-stackql` action in a GitHub Actions workflow, demonstrating how to use the action to install the `stackql` CLI and then use it to execute a StackQL query. ### GitHub Example -Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the GitHub provider for StackQL, see the [GitHub Provider Docs](https://registry.stackql.io/github). +Check the "Use GitHub Provider" step in [setup-stackql-test.yml](.github/workflows/setup-stackql-test.yml) for the working example, for more information on the GitHub provider for StackQL, see the [GitHub Provider Docs](https://registry.stackql.io/github). ```yaml - name: setup StackQL - uses: stackql/setup-stackql@v1.2.0 + uses: stackql/setup-stackql@v2.2.0 with: use_wrapper: true @@ -30,11 +30,11 @@ Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/se ``` ### Google Example -Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the Google provider for StackQL, see the [Google Provider Docs](https://registry.stackql.io/google). +Check the "Use Google Provider" step in [setup-stackql-test.yml](.github/workflows/setup-stackql-test.yml) for the working example, for more information on the Google provider for StackQL, see the [Google Provider Docs](https://registry.stackql.io/google). ```yaml - name: setup StackQL - uses: stackql/setup-stackql@v1.2.0 + uses: stackql/setup-stackql@v2.2.0 with: use_wrapper: true @@ -46,7 +46,7 @@ Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/se ``` ## Inputs -- `use_wrapper` - (optional) Whether to install a wrapper to wrap subsequent calls of +- __`use_wrapper`__ - (optional) Whether to install a wrapper to wrap subsequent calls of the `stackql` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `false`. @@ -54,6 +54,6 @@ Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/se This action does not configure any outputs directly. However, when you set the `use_wrapper` input to `true`, the following outputs are available for subsequent steps that call the `stackql` binary: -- `stdout` - The STDOUT stream of the call to the `stackql` binary. -- `stderr` - The STDERR stream of the call to the `stackql` binary. -- `exitcode` - The exit code of the call to the `stackql` binary. +- __`stdout`__ - The STDOUT stream of the call to the `stackql` binary. +- __`stderr`__ - The STDERR stream of the call to the `stackql` binary. +- __`exitcode`__ - The exit code of the call to the `stackql` binary. diff --git a/action.yml b/action.yml index 64846ff..282d2a1 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'StackQL Studios - Setup StackQL' +name: 'setup-stackql' description: 'Sets up the StackQL CLI in your GitHub Actions workflow.' author: 'Yuncheng Yang, Jeffrey Aven' inputs: @@ -8,8 +8,9 @@ inputs: required: false runs: - using: 'node16' + using: 'node20' main: 'dist/index.js' + branding: icon: 'terminal' - color: 'green' \ No newline at end of file + color: 'blue' \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 3e89b04..a900158 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 7351: +/***/ 8911: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -28,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(5278); +const utils_1 = __nccwpck_require__(5822); /** * Commands * @@ -100,7 +100,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2186: +/***/ 8379: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -135,12 +135,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(7351); -const file_command_1 = __nccwpck_require__(717); -const utils_1 = __nccwpck_require__(5278); +const command_1 = __nccwpck_require__(8911); +const file_command_1 = __nccwpck_require__(4567); +const utils_1 = __nccwpck_require__(5822); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(8041); +const oidc_utils_1 = __nccwpck_require__(3643); /** * The code to exit an action */ @@ -425,17 +425,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(1327); +var summary_1 = __nccwpck_require__(845); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(1327); +var summary_2 = __nccwpck_require__(845); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(2981); +var path_utils_1 = __nccwpck_require__(7426); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -443,7 +443,7 @@ Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: funct /***/ }), -/***/ 717: +/***/ 4567: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -474,8 +474,8 @@ exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(7147)); const os = __importStar(__nccwpck_require__(2037)); -const uuid_1 = __nccwpck_require__(8974); -const utils_1 = __nccwpck_require__(5278); +const uuid_1 = __nccwpck_require__(842); +const utils_1 = __nccwpck_require__(5822); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -508,7 +508,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 8041: +/***/ 3643: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -524,9 +524,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(6255); -const auth_1 = __nccwpck_require__(5526); -const core_1 = __nccwpck_require__(2186); +const http_client_1 = __nccwpck_require__(2385); +const auth_1 = __nccwpck_require__(9137); +const core_1 = __nccwpck_require__(8379); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -592,7 +592,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 2981: +/***/ 7426: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -657,7 +657,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 1327: +/***/ 845: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -947,7 +947,7 @@ exports.summary = _summary; /***/ }), -/***/ 5278: +/***/ 5822: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -994,7 +994,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 8974: +/***/ 842: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1058,29 +1058,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(1595)); +var _v = _interopRequireDefault(__nccwpck_require__(4732)); -var _v2 = _interopRequireDefault(__nccwpck_require__(6993)); +var _v2 = _interopRequireDefault(__nccwpck_require__(686)); -var _v3 = _interopRequireDefault(__nccwpck_require__(1472)); +var _v3 = _interopRequireDefault(__nccwpck_require__(5870)); -var _v4 = _interopRequireDefault(__nccwpck_require__(6217)); +var _v4 = _interopRequireDefault(__nccwpck_require__(8489)); -var _nil = _interopRequireDefault(__nccwpck_require__(2381)); +var _nil = _interopRequireDefault(__nccwpck_require__(7359)); -var _version = _interopRequireDefault(__nccwpck_require__(427)); +var _version = _interopRequireDefault(__nccwpck_require__(5177)); -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(4513)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(9917)); -var _parse = _interopRequireDefault(__nccwpck_require__(6385)); +var _parse = _interopRequireDefault(__nccwpck_require__(4806)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 5842: +/***/ 2644: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1110,7 +1110,7 @@ exports["default"] = _default; /***/ }), -/***/ 2381: +/***/ 7359: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1125,7 +1125,7 @@ exports["default"] = _default; /***/ }), -/***/ 6385: +/***/ 4806: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1136,7 +1136,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(4513)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1177,7 +1177,7 @@ exports["default"] = _default; /***/ }), -/***/ 6230: +/***/ 9313: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1192,7 +1192,7 @@ exports["default"] = _default; /***/ }), -/***/ 9784: +/***/ 8920: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1223,7 +1223,7 @@ function rng() { /***/ }), -/***/ 8844: +/***/ 2389: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1253,7 +1253,7 @@ exports["default"] = _default; /***/ }), -/***/ 1458: +/***/ 9917: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1264,7 +1264,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(4513)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1299,7 +1299,7 @@ exports["default"] = _default; /***/ }), -/***/ 1595: +/***/ 4732: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1310,9 +1310,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(9784)); +var _rng = _interopRequireDefault(__nccwpck_require__(8920)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(9917)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1413,7 +1413,7 @@ exports["default"] = _default; /***/ }), -/***/ 6993: +/***/ 686: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1424,9 +1424,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(5920)); +var _v = _interopRequireDefault(__nccwpck_require__(2858)); -var _md = _interopRequireDefault(__nccwpck_require__(5842)); +var _md = _interopRequireDefault(__nccwpck_require__(2644)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1436,7 +1436,7 @@ exports["default"] = _default; /***/ }), -/***/ 5920: +/***/ 2858: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1448,9 +1448,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(9917)); -var _parse = _interopRequireDefault(__nccwpck_require__(6385)); +var _parse = _interopRequireDefault(__nccwpck_require__(4806)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1521,7 +1521,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 1472: +/***/ 5870: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1532,9 +1532,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(9784)); +var _rng = _interopRequireDefault(__nccwpck_require__(8920)); -var _stringify = _interopRequireDefault(__nccwpck_require__(1458)); +var _stringify = _interopRequireDefault(__nccwpck_require__(9917)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1565,7 +1565,7 @@ exports["default"] = _default; /***/ }), -/***/ 6217: +/***/ 8489: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1576,9 +1576,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(5920)); +var _v = _interopRequireDefault(__nccwpck_require__(2858)); -var _sha = _interopRequireDefault(__nccwpck_require__(8844)); +var _sha = _interopRequireDefault(__nccwpck_require__(2389)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1588,7 +1588,7 @@ exports["default"] = _default; /***/ }), -/***/ 2609: +/***/ 4513: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1599,7 +1599,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(6230)); +var _regex = _interopRequireDefault(__nccwpck_require__(9313)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1612,7 +1612,7 @@ exports["default"] = _default; /***/ }), -/***/ 427: +/***/ 5177: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1623,7 +1623,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2609)); +var _validate = _interopRequireDefault(__nccwpck_require__(4513)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1640,7 +1640,7 @@ exports["default"] = _default; /***/ }), -/***/ 1514: +/***/ 8069: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1676,7 +1676,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; const string_decoder_1 = __nccwpck_require__(1576); -const tr = __importStar(__nccwpck_require__(8159)); +const tr = __importStar(__nccwpck_require__(4619)); /** * Exec a command. * Output will be streamed to the live console. @@ -1750,7 +1750,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 8159: +/***/ 4619: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1789,8 +1789,8 @@ const os = __importStar(__nccwpck_require__(2037)); const events = __importStar(__nccwpck_require__(2361)); const child = __importStar(__nccwpck_require__(2081)); const path = __importStar(__nccwpck_require__(1017)); -const io = __importStar(__nccwpck_require__(7436)); -const ioUtil = __importStar(__nccwpck_require__(1962)); +const io = __importStar(__nccwpck_require__(1144)); +const ioUtil = __importStar(__nccwpck_require__(1459)); const timers_1 = __nccwpck_require__(9512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; @@ -2375,7 +2375,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 5526: +/***/ 9137: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -2463,7 +2463,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 6255: +/***/ 2385: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2501,8 +2501,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; const http = __importStar(__nccwpck_require__(3685)); const https = __importStar(__nccwpck_require__(5687)); -const pm = __importStar(__nccwpck_require__(9835)); -const tunnel = __importStar(__nccwpck_require__(4294)); +const pm = __importStar(__nccwpck_require__(5286)); +const tunnel = __importStar(__nccwpck_require__(6206)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -3075,7 +3075,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 9835: +/***/ 5286: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -3143,7 +3143,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 1962: +/***/ 1459: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3327,7 +3327,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 7436: +/***/ 1144: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3366,7 +3366,7 @@ const assert_1 = __nccwpck_require__(9491); const childProcess = __importStar(__nccwpck_require__(2081)); const path = __importStar(__nccwpck_require__(1017)); const util_1 = __nccwpck_require__(3837); -const ioUtil = __importStar(__nccwpck_require__(1962)); +const ioUtil = __importStar(__nccwpck_require__(1459)); const exec = util_1.promisify(childProcess.exec); const execFile = util_1.promisify(childProcess.execFile); /** @@ -3675,7 +3675,7 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 2473: +/***/ 2789: /***/ (function(module, exports, __nccwpck_require__) { "use strict"; @@ -3710,8 +3710,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0; -const semver = __importStar(__nccwpck_require__(5911)); -const core_1 = __nccwpck_require__(2186); +const semver = __importStar(__nccwpck_require__(8192)); +const core_1 = __nccwpck_require__(8379); // needs to be require for core node modules to be mocked /* eslint @typescript-eslint/no-require-imports: 0 */ const os = __nccwpck_require__(2037); @@ -3810,7 +3810,7 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; /***/ }), -/***/ 8279: +/***/ 9896: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3845,7 +3845,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RetryHelper = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(8379)); /** * Internal class for retries */ @@ -3900,7 +3900,7 @@ exports.RetryHelper = RetryHelper; /***/ }), -/***/ 7784: +/***/ 8060: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3938,20 +3938,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const io = __importStar(__nccwpck_require__(7436)); +const core = __importStar(__nccwpck_require__(8379)); +const io = __importStar(__nccwpck_require__(1144)); const fs = __importStar(__nccwpck_require__(7147)); -const mm = __importStar(__nccwpck_require__(2473)); +const mm = __importStar(__nccwpck_require__(2789)); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const httpm = __importStar(__nccwpck_require__(6255)); -const semver = __importStar(__nccwpck_require__(5911)); +const httpm = __importStar(__nccwpck_require__(2385)); +const semver = __importStar(__nccwpck_require__(8192)); const stream = __importStar(__nccwpck_require__(2781)); const util = __importStar(__nccwpck_require__(3837)); const assert_1 = __nccwpck_require__(9491); -const v4_1 = __importDefault(__nccwpck_require__(824)); -const exec_1 = __nccwpck_require__(1514); -const retry_helper_1 = __nccwpck_require__(8279); +const v4_1 = __importDefault(__nccwpck_require__(2623)); +const exec_1 = __nccwpck_require__(8069); +const retry_helper_1 = __nccwpck_require__(9896); class HTTPError extends Error { constructor(httpStatusCode) { super(`Unexpected HTTP response: ${httpStatusCode}`); @@ -4572,7 +4572,7 @@ function _unique(values) { /***/ }), -/***/ 5911: +/***/ 8192: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -4603,8 +4603,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var t = exports.tokens = {} var R = 0 @@ -4613,6 +4616,31 @@ function tok (n) { t[n] = R++ } +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -4622,14 +4650,14 @@ function tok (n) { tok('NUMERICIDENTIFIER') src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -4671,7 +4699,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -4751,6 +4779,7 @@ src[t.COERCE] = '(^|[^\\d])' + '(?:$|[^\\d])' tok('COERCERTL') re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') // Tilde ranges. // Meaning is "reasonably at or greater than" @@ -4760,6 +4789,7 @@ src[t.LONETILDE] = '(?:~>?)' tok('TILDETRIM') src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') var tildeTrimReplace = '$1~' tok('TILDE') @@ -4775,6 +4805,7 @@ src[t.LONECARET] = '(?:\\^)' tok('CARETTRIM') src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') var caretTrimReplace = '$1^' tok('CARET') @@ -4796,6 +4827,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + // this one has to use the /g flag re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -4824,6 +4856,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -4848,7 +4888,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[t.LOOSE] : re[t.FULL] + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] if (!r.test(version)) { return null } @@ -4903,7 +4943,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -5348,6 +5388,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -5364,7 +5405,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var m = comp.match(r) if (!m) { @@ -5488,9 +5529,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -5498,7 +5546,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -5517,20 +5565,19 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') @@ -5538,7 +5585,7 @@ Range.prototype.parseRange = function (range) { // At this point, the range is completely trimmed and // ready to be split into comparators. - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -5638,7 +5685,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -5679,7 +5726,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -5738,7 +5785,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -5813,7 +5860,7 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return comp.trim().replace(safeRe[t.STAR], '') } // This function is passed to string.replace(re[t.HYPHENRANGE]) @@ -6139,7 +6186,7 @@ function coerce (version, options) { var match = null if (!options.rtl) { - match = version.match(re[t.COERCE]) + match = version.match(safeRe[t.COERCE]) } else { // Find the right-most coercible string that does not share // a terminus with a more left-ward coercible string. @@ -6150,17 +6197,17 @@ function coerce (version, options) { // Stop when we get a match that ends at the string end, since no // coercible string can be more right-ward without the same terminus. var next - while ((next = re[t.COERCERTL].exec(version)) && + while ((next = safeRe[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length) ) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length } // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 + safeRe[t.COERCERTL].lastIndex = -1 } if (match === null) { @@ -6175,15 +6222,15 @@ function coerce (version, options) { /***/ }), -/***/ 4294: +/***/ 6206: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(4219); +module.exports = __nccwpck_require__(5238); /***/ }), -/***/ 4219: +/***/ 5238: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -6455,7 +6502,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 2707: +/***/ 1103: /***/ ((module) => { /** @@ -6488,7 +6535,7 @@ module.exports = bytesToUuid; /***/ }), -/***/ 5859: +/***/ 28: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Unique ID creation requires a high quality random # generator. In node.js @@ -6503,11 +6550,11 @@ module.exports = function nodeRNG() { /***/ }), -/***/ 824: +/***/ 2623: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var rng = __nccwpck_require__(5859); -var bytesToUuid = __nccwpck_require__(2707); +var rng = __nccwpck_require__(28); +var bytesToUuid = __nccwpck_require__(1103); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -6704,40 +6751,50 @@ const path = __nccwpck_require__(1017); const fs = __nccwpck_require__(7147); const os = __nccwpck_require__(2037); const { execSync } = __nccwpck_require__(2081); -const core = __nccwpck_require__(2186); -const tc = __nccwpck_require__(7784); -const io = __nccwpck_require__(7436); +const core = __nccwpck_require__(8379); +const tc = __nccwpck_require__(8060); +const io = __nccwpck_require__(1144); const urls = { 'linux': 'https://releases.stackql.io/stackql/latest/stackql_linux_amd64.zip', - 'darwin': 'https://storage.googleapis.com/stackql-public-releases/latest/stackql_darwin_multiarch.pkg', 'win32': 'https://releases.stackql.io/stackql/latest/stackql_windows_amd64.zip', } -async function downloadCLI(osPlatform){ +async function downloadCLI(osPlatform) { try { - - core.info(`downloading stackql binary for ${osPlatform}`); - const url = urls[osPlatform] - core.debug(`binary location: ${url}`); + core.info(`preparing to download/install stackql for ${osPlatform}`); switch (osPlatform) { case 'win32': - return await tc.extractZip(await tc.downloadTool(url)); - case 'darwin': - let tmpPath = await tc.downloadTool(url); - core.info(`extracting mac pkg in ${tmpPath}...`); - const installPath = '/Users/runner/work/_temp/stackql-pkg'; - execSync(`pkgutil --expand-full ${tmpPath} ${installPath}`); - return `${installPath}/Payload`; + return await tc.extractZip(await tc.downloadTool(urls[osPlatform])); + case 'darwin': + // Check if stackql is already installed using brew list --formula + core.info(`checking if stackql is already installed...`); + try { + const installedFormulas = execSync('brew list --formula', { encoding: 'utf-8' }); + if (installedFormulas.includes('stackql')) { + core.info(`stackql is already installed.`); + const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim(); + core.debug(`stackql is located at: ${stackqlPath}`); + return path.dirname(stackqlPath); // Return the directory of the binary + } else { + core.info(`installing stackql using Homebrew...`); + execSync('brew install stackql', { stdio: 'inherit' }); + } + } catch (error) { + core.info(`error checking/installing stackql: ${error}`); + throw new Error(`error checking/installing stackql: ${error}`); + } + const installedPath = execSync('which stackql', { encoding: 'utf-8' }).trim(); + core.debug(`stackql installed at: ${installedPath}`); + return path.dirname(installedPath); // Return the directory of the binary case 'linux': - return await tc.extractZip(await tc.downloadTool(url)); + return await tc.extractZip(await tc.downloadTool(urls[osPlatform])); default: - throw new Error(`Unsupported platform: ${osPlatform}`); + throw new Error(`unsupported platform: ${osPlatform}`); } - } catch (error) { - core.error(error); + core.error(`failed to install stackql: ${error}`); throw error; } } @@ -6756,7 +6813,6 @@ async function makeExecutable(cliPath, osPlatform){ } } - async function installWrapper (pathToCLI) { let source, target; @@ -6767,10 +6823,10 @@ async function installWrapper (pathToCLI) { try { source = [pathToCLI, `stackql${exeSuffix}`].join(path.sep); target = [pathToCLI, `stackql-bin${exeSuffix}`].join(path.sep); - core.debug(`Moving ${source} to ${target}.`); + core.debug(`moving ${source} to ${target}...`); await io.mv(source, target); } catch (e) { - core.debug(`Unable to move ${source} to ${target}.`); + core.debug(`unable to move ${source} to ${target}.`); throw e; } @@ -6778,10 +6834,10 @@ async function installWrapper (pathToCLI) { try { source = path.resolve([__dirname, '..', 'wrapper', 'dist', 'index.js'].join(path.sep)); target = [pathToCLI, 'stackql'].join(path.sep); - core.debug(`Copying ${source} to ${target}.`); + core.debug(`copying ${source} to ${target}...`); await io.cp(source, target); } catch (e) { - core.error(`Unable to copy ${source} to ${target}.`); + core.error(`unable to copy ${source} to ${target}.`); throw e; } @@ -6805,19 +6861,19 @@ async function setup() { core.debug(`path to cli: ${cliPath}`); // set perms and make executable - core.debug(`updating permissions for ${cliPath}`); - fs.chmodSync(cliPath, '777'); - - core.debug(`adding ${cliPath} to the path`); - core.addPath(cliPath) - - await makeExecutable(cliPath, osPlatform) - - const wrapper = core.getInput('use_wrapper') === 'true'; - - if(wrapper){ - core.info('installing wrapper') - await installWrapper(cliPath) + if(osPlatform !== 'darwin'){ + core.debug(`updating permissions for ${cliPath}...`); + fs.chmodSync(cliPath, '777'); + core.debug(`adding ${cliPath} to the path...`); + core.addPath(cliPath) + await makeExecutable(cliPath, osPlatform) + } + + // Check if wrapper is needed and if it's not Darwin + const useWrapper = core.getInput('use_wrapper') === 'true'; + if(useWrapper && osPlatform !== 'darwin'){ + core.info('installing wrapper...'); + await installWrapper(cliPath); } core.info(`successfully setup stackql at ${cliPath}`); diff --git a/index.js b/index.js index 012a20b..b41513e 100644 --- a/index.js +++ b/index.js @@ -8,34 +8,44 @@ const io = require('@actions/io'); const urls = { 'linux': 'https://releases.stackql.io/stackql/latest/stackql_linux_amd64.zip', - 'darwin': 'https://storage.googleapis.com/stackql-public-releases/latest/stackql_darwin_multiarch.pkg', 'win32': 'https://releases.stackql.io/stackql/latest/stackql_windows_amd64.zip', } -async function downloadCLI(osPlatform){ +async function downloadCLI(osPlatform) { try { - - core.info(`downloading stackql binary for ${osPlatform}`); - const url = urls[osPlatform] - core.debug(`binary location: ${url}`); + core.info(`preparing to download/install stackql for ${osPlatform}`); switch (osPlatform) { case 'win32': - return await tc.extractZip(await tc.downloadTool(url)); - case 'darwin': - let tmpPath = await tc.downloadTool(url); - core.info(`extracting mac pkg in ${tmpPath}...`); - const installPath = '/Users/runner/work/_temp/stackql-pkg'; - execSync(`pkgutil --expand-full ${tmpPath} ${installPath}`); - return `${installPath}/Payload`; + return await tc.extractZip(await tc.downloadTool(urls[osPlatform])); + case 'darwin': + // Check if stackql is already installed using brew list --formula + core.info(`checking if stackql is already installed...`); + try { + const installedFormulas = execSync('brew list --formula', { encoding: 'utf-8' }); + if (installedFormulas.includes('stackql')) { + core.info(`stackql is already installed.`); + const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim(); + core.debug(`stackql is located at: ${stackqlPath}`); + return path.dirname(stackqlPath); // Return the directory of the binary + } else { + core.info(`installing stackql using Homebrew...`); + execSync('brew install stackql', { stdio: 'inherit' }); + } + } catch (error) { + core.info(`error checking/installing stackql: ${error}`); + throw new Error(`error checking/installing stackql: ${error}`); + } + const installedPath = execSync('which stackql', { encoding: 'utf-8' }).trim(); + core.debug(`stackql installed at: ${installedPath}`); + return path.dirname(installedPath); // Return the directory of the binary case 'linux': - return await tc.extractZip(await tc.downloadTool(url)); + return await tc.extractZip(await tc.downloadTool(urls[osPlatform])); default: - throw new Error(`Unsupported platform: ${osPlatform}`); + throw new Error(`unsupported platform: ${osPlatform}`); } - } catch (error) { - core.error(error); + core.error(`failed to install stackql: ${error}`); throw error; } } @@ -54,7 +64,6 @@ async function makeExecutable(cliPath, osPlatform){ } } - async function installWrapper (pathToCLI) { let source, target; @@ -65,10 +74,10 @@ async function installWrapper (pathToCLI) { try { source = [pathToCLI, `stackql${exeSuffix}`].join(path.sep); target = [pathToCLI, `stackql-bin${exeSuffix}`].join(path.sep); - core.debug(`Moving ${source} to ${target}.`); + core.debug(`moving ${source} to ${target}...`); await io.mv(source, target); } catch (e) { - core.debug(`Unable to move ${source} to ${target}.`); + core.debug(`unable to move ${source} to ${target}.`); throw e; } @@ -76,10 +85,10 @@ async function installWrapper (pathToCLI) { try { source = path.resolve([__dirname, '..', 'wrapper', 'dist', 'index.js'].join(path.sep)); target = [pathToCLI, 'stackql'].join(path.sep); - core.debug(`Copying ${source} to ${target}.`); + core.debug(`copying ${source} to ${target}...`); await io.cp(source, target); } catch (e) { - core.error(`Unable to copy ${source} to ${target}.`); + core.error(`unable to copy ${source} to ${target}.`); throw e; } @@ -103,19 +112,19 @@ async function setup() { core.debug(`path to cli: ${cliPath}`); // set perms and make executable - core.debug(`updating permissions for ${cliPath}`); - fs.chmodSync(cliPath, '777'); - - core.debug(`adding ${cliPath} to the path`); - core.addPath(cliPath) - - await makeExecutable(cliPath, osPlatform) - - const wrapper = core.getInput('use_wrapper') === 'true'; + if(osPlatform !== 'darwin'){ + core.debug(`updating permissions for ${cliPath}...`); + fs.chmodSync(cliPath, '777'); + core.debug(`adding ${cliPath} to the path...`); + core.addPath(cliPath) + await makeExecutable(cliPath, osPlatform) + } - if(wrapper){ - core.info('installing wrapper') - await installWrapper(cliPath) + // Check if wrapper is needed and if it's not Darwin + const useWrapper = core.getInput('use_wrapper') === 'true'; + if(useWrapper && osPlatform !== 'darwin'){ + core.info('installing wrapper...'); + await installWrapper(cliPath); } core.info(`successfully setup stackql at ${cliPath}`); diff --git a/package-lock.json b/package-lock.json index c732065..f9529e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.1.0", "hasInstallScript": true, "license": "ISC", "dependencies": { @@ -253,9 +253,9 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "bin": { "semver": "bin/semver.js" } @@ -508,9 +508,9 @@ } }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" }, "tr46": { "version": "0.0.3", diff --git a/package.json b/package.json index 0fc3725..dbfb240 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-stackql", - "version": "1.2.0", + "version": "2.2.1", "description": "", "main": "index.js", "scripts": { diff --git a/wrapper/dist/index.js b/wrapper/dist/index.js index 423ac97..a46f5f2 100755 --- a/wrapper/dist/index.js +++ b/wrapper/dist/index.js @@ -2,7 +2,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 190: +/***/ 650: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -29,7 +29,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(37)); -const utils_1 = __nccwpck_require__(861); +const utils_1 = __nccwpck_require__(326); /** * Commands * @@ -101,7 +101,7 @@ function escapeProperty(s) { /***/ }), -/***/ 316: +/***/ 58: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -136,12 +136,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(190); -const file_command_1 = __nccwpck_require__(685); -const utils_1 = __nccwpck_require__(861); +const command_1 = __nccwpck_require__(650); +const file_command_1 = __nccwpck_require__(370); +const utils_1 = __nccwpck_require__(326); const os = __importStar(__nccwpck_require__(37)); const path = __importStar(__nccwpck_require__(17)); -const oidc_utils_1 = __nccwpck_require__(419); +const oidc_utils_1 = __nccwpck_require__(461); /** * The code to exit an action */ @@ -426,17 +426,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(656); +var summary_1 = __nccwpck_require__(597); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(656); +var summary_2 = __nccwpck_require__(597); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(989); +var path_utils_1 = __nccwpck_require__(584); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -444,7 +444,7 @@ Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: funct /***/ }), -/***/ 685: +/***/ 370: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -475,8 +475,8 @@ exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(147)); const os = __importStar(__nccwpck_require__(37)); -const uuid_1 = __nccwpck_require__(449); -const utils_1 = __nccwpck_require__(861); +const uuid_1 = __nccwpck_require__(944); +const utils_1 = __nccwpck_require__(326); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -509,7 +509,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 419: +/***/ 461: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -525,9 +525,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(315); -const auth_1 = __nccwpck_require__(421); -const core_1 = __nccwpck_require__(316); +const http_client_1 = __nccwpck_require__(445); +const auth_1 = __nccwpck_require__(576); +const core_1 = __nccwpck_require__(58); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -593,7 +593,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 989: +/***/ 584: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -658,7 +658,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 656: +/***/ 597: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -948,7 +948,7 @@ exports.summary = _summary; /***/ }), -/***/ 861: +/***/ 326: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -995,7 +995,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 449: +/***/ 944: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1059,29 +1059,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(869)); +var _v = _interopRequireDefault(__nccwpck_require__(912)); -var _v2 = _interopRequireDefault(__nccwpck_require__(398)); +var _v2 = _interopRequireDefault(__nccwpck_require__(660)); -var _v3 = _interopRequireDefault(__nccwpck_require__(736)); +var _v3 = _interopRequireDefault(__nccwpck_require__(67)); -var _v4 = _interopRequireDefault(__nccwpck_require__(938)); +var _v4 = _interopRequireDefault(__nccwpck_require__(705)); -var _nil = _interopRequireDefault(__nccwpck_require__(712)); +var _nil = _interopRequireDefault(__nccwpck_require__(483)); -var _version = _interopRequireDefault(__nccwpck_require__(760)); +var _version = _interopRequireDefault(__nccwpck_require__(716)); -var _validate = _interopRequireDefault(__nccwpck_require__(84)); +var _validate = _interopRequireDefault(__nccwpck_require__(264)); -var _stringify = _interopRequireDefault(__nccwpck_require__(150)); +var _stringify = _interopRequireDefault(__nccwpck_require__(779)); -var _parse = _interopRequireDefault(__nccwpck_require__(148)); +var _parse = _interopRequireDefault(__nccwpck_require__(197)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 797: +/***/ 446: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1111,7 +1111,7 @@ exports["default"] = _default; /***/ }), -/***/ 712: +/***/ 483: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1126,7 +1126,7 @@ exports["default"] = _default; /***/ }), -/***/ 148: +/***/ 197: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1137,7 +1137,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(84)); +var _validate = _interopRequireDefault(__nccwpck_require__(264)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1178,7 +1178,7 @@ exports["default"] = _default; /***/ }), -/***/ 393: +/***/ 913: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1193,7 +1193,7 @@ exports["default"] = _default; /***/ }), -/***/ 934: +/***/ 376: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1224,7 +1224,7 @@ function rng() { /***/ }), -/***/ 247: +/***/ 13: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1254,7 +1254,7 @@ exports["default"] = _default; /***/ }), -/***/ 150: +/***/ 779: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1265,7 +1265,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(84)); +var _validate = _interopRequireDefault(__nccwpck_require__(264)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1300,7 +1300,7 @@ exports["default"] = _default; /***/ }), -/***/ 869: +/***/ 912: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1311,9 +1311,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(934)); +var _rng = _interopRequireDefault(__nccwpck_require__(376)); -var _stringify = _interopRequireDefault(__nccwpck_require__(150)); +var _stringify = _interopRequireDefault(__nccwpck_require__(779)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1414,7 +1414,7 @@ exports["default"] = _default; /***/ }), -/***/ 398: +/***/ 660: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1425,9 +1425,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(313)); +var _v = _interopRequireDefault(__nccwpck_require__(751)); -var _md = _interopRequireDefault(__nccwpck_require__(797)); +var _md = _interopRequireDefault(__nccwpck_require__(446)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1437,7 +1437,7 @@ exports["default"] = _default; /***/ }), -/***/ 313: +/***/ 751: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1449,9 +1449,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(150)); +var _stringify = _interopRequireDefault(__nccwpck_require__(779)); -var _parse = _interopRequireDefault(__nccwpck_require__(148)); +var _parse = _interopRequireDefault(__nccwpck_require__(197)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1522,7 +1522,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 736: +/***/ 67: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1533,9 +1533,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(934)); +var _rng = _interopRequireDefault(__nccwpck_require__(376)); -var _stringify = _interopRequireDefault(__nccwpck_require__(150)); +var _stringify = _interopRequireDefault(__nccwpck_require__(779)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1566,7 +1566,7 @@ exports["default"] = _default; /***/ }), -/***/ 938: +/***/ 705: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1577,9 +1577,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(313)); +var _v = _interopRequireDefault(__nccwpck_require__(751)); -var _sha = _interopRequireDefault(__nccwpck_require__(247)); +var _sha = _interopRequireDefault(__nccwpck_require__(13)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1589,7 +1589,7 @@ exports["default"] = _default; /***/ }), -/***/ 84: +/***/ 264: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1600,7 +1600,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(393)); +var _regex = _interopRequireDefault(__nccwpck_require__(913)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1613,7 +1613,7 @@ exports["default"] = _default; /***/ }), -/***/ 760: +/***/ 716: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -1624,7 +1624,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(84)); +var _validate = _interopRequireDefault(__nccwpck_require__(264)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -1641,7 +1641,7 @@ exports["default"] = _default; /***/ }), -/***/ 110: +/***/ 323: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1676,8 +1676,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; -const string_decoder_1 = __nccwpck_require__(576); -const tr = __importStar(__nccwpck_require__(515)); +const string_decoder_1 = __nccwpck_require__(117); +const tr = __importStar(__nccwpck_require__(633)); /** * Exec a command. * Output will be streamed to the live console. @@ -1751,7 +1751,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 515: +/***/ 633: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1790,8 +1790,8 @@ const os = __importStar(__nccwpck_require__(37)); const events = __importStar(__nccwpck_require__(361)); const child = __importStar(__nccwpck_require__(81)); const path = __importStar(__nccwpck_require__(17)); -const io = __importStar(__nccwpck_require__(560)); -const ioUtil = __importStar(__nccwpck_require__(995)); +const io = __importStar(__nccwpck_require__(75)); +const ioUtil = __importStar(__nccwpck_require__(749)); const timers_1 = __nccwpck_require__(512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; @@ -2376,7 +2376,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 421: +/***/ 576: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -2464,7 +2464,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 315: +/***/ 445: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2500,10 +2500,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(__nccwpck_require__(181)); +const http = __importStar(__nccwpck_require__(685)); const https = __importStar(__nccwpck_require__(687)); -const pm = __importStar(__nccwpck_require__(233)); -const tunnel = __importStar(__nccwpck_require__(220)); +const pm = __importStar(__nccwpck_require__(247)); +const tunnel = __importStar(__nccwpck_require__(752)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -3076,7 +3076,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 233: +/***/ 247: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -3144,7 +3144,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 995: +/***/ 749: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3328,7 +3328,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 560: +/***/ 75: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -3367,7 +3367,7 @@ const assert_1 = __nccwpck_require__(491); const childProcess = __importStar(__nccwpck_require__(81)); const path = __importStar(__nccwpck_require__(17)); const util_1 = __nccwpck_require__(837); -const ioUtil = __importStar(__nccwpck_require__(995)); +const ioUtil = __importStar(__nccwpck_require__(749)); const exec = util_1.promisify(childProcess.exec); const execFile = util_1.promisify(childProcess.execFile); /** @@ -3676,15 +3676,15 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 220: +/***/ 752: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(418); +module.exports = __nccwpck_require__(77); /***/ }), -/***/ 418: +/***/ 77: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3692,7 +3692,7 @@ module.exports = __nccwpck_require__(418); var net = __nccwpck_require__(808); var tls = __nccwpck_require__(404); -var http = __nccwpck_require__(181); +var http = __nccwpck_require__(685); var https = __nccwpck_require__(687); var events = __nccwpck_require__(361); var assert = __nccwpck_require__(491); @@ -3956,7 +3956,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 127: +/***/ 748: /***/ ((module) => { /** @@ -3999,7 +3999,7 @@ class OutputListener { /***/ }), -/***/ 183: +/***/ 392: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const os = __nccwpck_require__(37); @@ -4054,7 +4054,7 @@ module.exports = require("fs"); /***/ }), -/***/ 181: +/***/ 685: /***/ ((module) => { "use strict"; @@ -4094,7 +4094,7 @@ module.exports = require("path"); /***/ }), -/***/ 576: +/***/ 117: /***/ ((module) => { "use strict"; @@ -4167,12 +4167,12 @@ module.exports = require("util"); var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { -const io = __nccwpck_require__(560); -const core = __nccwpck_require__(316); -const { exec } = __nccwpck_require__(110); +const io = __nccwpck_require__(75); +const core = __nccwpck_require__(58); +const { exec } = __nccwpck_require__(323); -const OutputListener = __nccwpck_require__(127); -const pathToCLI = __nccwpck_require__(183); +const OutputListener = __nccwpck_require__(748); +const pathToCLI = __nccwpck_require__(392); async function checkStackQL () { // Setting check to `true` will cause `which` to throw if stackql isn't found @@ -4208,7 +4208,7 @@ async function checkStackQL () { core.setOutput('stdout', stdout.contents); core.setOutput('stderr', stderr.contents); - if ((exitCode === 0 || exitCode === 2) && !stderr.contents) { + if (exitCode === 0 || exitCode === 2) { // A exitCode of 0 is considered a success // An exitCode of 2 may be returned when the '-detailed-exitcode' option // is passed to plan. This denotes Success with non-empty @@ -4216,8 +4216,9 @@ async function checkStackQL () { return; } - // A non-zero exitCode is considered an error - core.setFailed(`StackQL exited with error: ${stderr.contents}.`); + // If we reach this point, it means that the exitCode was neither 0 nor 2, + // which denotes an error. We can still use stderr.contents to provide more information about the error. + core.setFailed(`StackQL exited with error code ${exitCode}. Details: ${stderr.contents}.`); })(); })(); diff --git a/wrapper/stackql.js b/wrapper/stackql.js index 147db13..4f4f349 100644 --- a/wrapper/stackql.js +++ b/wrapper/stackql.js @@ -40,7 +40,7 @@ async function checkStackQL () { core.setOutput('stdout', stdout.contents); core.setOutput('stderr', stderr.contents); - if ((exitCode === 0 || exitCode === 2) && !stderr.contents) { + if (exitCode === 0 || exitCode === 2) { // A exitCode of 0 is considered a success // An exitCode of 2 may be returned when the '-detailed-exitcode' option // is passed to plan. This denotes Success with non-empty @@ -48,6 +48,7 @@ async function checkStackQL () { return; } - // A non-zero exitCode is considered an error - core.setFailed(`StackQL exited with error: ${stderr.contents}.`); + // If we reach this point, it means that the exitCode was neither 0 nor 2, + // which denotes an error. We can still use stderr.contents to provide more information about the error. + core.setFailed(`StackQL exited with error code ${exitCode}. Details: ${stderr.contents}.`); })();