From 9b6c8e9745b3d5a1417f6aa3e627e5e97d2cb929 Mon Sep 17 00:00:00 2001
From: Raj Kumar Panda <rajkumar@stepsecurity.io>
Date: Thu, 5 Dec 2024 14:08:16 +0530
Subject: [PATCH] comments addressed

---
 dist/index.js | 782 +++++++++++++++++++++++++-------------------------
 package.json  |   2 +-
 2 files changed, 392 insertions(+), 392 deletions(-)

diff --git a/dist/index.js b/dist/index.js
index 165530c..00f7f15 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,396 +1,6 @@
 /******/ (() => { // webpackBootstrap
 /******/ 	var __webpack_modules__ = ({
 
-/***/ 43761:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
-    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
-    return new (P || (P = Promise))(function (resolve, reject) {
-        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
-        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
-        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
-        step((generator = generator.apply(thisArg, _arguments || [])).next());
-    });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const actionlib = __nccwpck_require__(87740);
-const baseUtilLib = __nccwpck_require__(12365);
-const core = __nccwpck_require__(42186);
-const vcpkgAction = __nccwpck_require__(12929);
-const axios_1 = __nccwpck_require__(88757);
-function validateSubscription() {
-    return __awaiter(this, void 0, void 0, function* () {
-        const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
-        try {
-            yield axios_1.default.get(API_URL, { timeout: 3000 });
-        }
-        catch (error) {
-            if ((0, axios_1.isAxiosError)(error) && error.response) {
-                core.error('Subscription is not valid. Reach out to support@stepsecurity.io');
-                process.exit(1);
-            }
-            else {
-                core.info('Timeout or API not reachable. Continuing to next step.');
-            }
-        }
-    });
-}
-function main() {
-    var _a;
-    return __awaiter(this, void 0, void 0, function* () {
-        yield validateSubscription();
-        try {
-            const actionLib = new actionlib.ActionLib();
-            const baseUtil = new baseUtilLib.BaseUtilLib(actionLib);
-            const action = new vcpkgAction.VcpkgAction(baseUtil);
-            yield action.run();
-            core.info('run-vcpkg action execution succeeded');
-            process.exitCode = 0;
-        }
-        catch (err) {
-            const error = err;
-            if (error === null || error === void 0 ? void 0 : error.stack) {
-                core.info(error.stack);
-            }
-            const errorAsString = (_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : "undefined error";
-            core.setFailed(`run-vcpkg action execution failed: ${errorAsString}`);
-            process.exitCode = -1000;
-        }
-    });
-}
-// Main entry point of the task.
-main().catch(error => console.error("main() failed!", error));
-//# sourceMappingURL=action.js.map
-
-/***/ }),
-
-/***/ 12929:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
-    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
-    return new (P || (P = Promise))(function (resolve, reject) {
-        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
-        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
-        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
-        step((generator = generator.apply(thisArg, _arguments || [])).next());
-    });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.VcpkgAction = exports.vcpkgConfigurationJsonGlob = exports.logCollectionRegExpsInput = exports.vcpkgUrlInput = exports.doNotUpdateVcpkgInput = exports.vcpkgCommitIdInput = exports.vcpkgDirectoryInput = exports.runVcpkgFormatStringInput = exports.runVcpkgInstallInput = exports.vcpkgJsonIgnoresInput = exports.vcpkgJsonGlobInput = exports.binaryCachePathInput = exports.additionalCachedPathsInput = exports.doNotCacheInput = void 0;
-const path = __nccwpck_require__(71017);
-const cache = __nccwpck_require__(27799);
-const runvcpkglib = __nccwpck_require__(44393);
-const vcpkgutil = __nccwpck_require__(94534);
-// Input names for run-vcpkg only.
-exports.doNotCacheInput = 'DONOTCACHE';
-exports.additionalCachedPathsInput = 'ADDITIONALCACHEDPATHS';
-exports.binaryCachePathInput = 'BINARYCACHEPATH';
-exports.vcpkgJsonGlobInput = 'VCPKGJSONGLOB';
-exports.vcpkgJsonIgnoresInput = "VCPKGJSONIGNORES";
-exports.runVcpkgInstallInput = 'RUNVCPKGINSTALL';
-exports.runVcpkgFormatStringInput = "RUNVCPKGFORMATSTRING";
-exports.vcpkgDirectoryInput = "VCPKGDIRECTORY";
-exports.vcpkgCommitIdInput = "VCPKGGITCOMMITID";
-exports.doNotUpdateVcpkgInput = "DONOTUPDATEVCPKG";
-exports.vcpkgUrlInput = "VCPKGGITURL";
-exports.logCollectionRegExpsInput = 'LOGCOLLECTIONREGEXPS';
-exports.vcpkgConfigurationJsonGlob = 'VCPKGCONFIGURATIONJSONGLOB';
-class VcpkgAction {
-    constructor(baseUtilLib) {
-        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
-        this.baseUtilLib = baseUtilLib;
-        this.doNotCache = true;
-        this.runVcpkgInstall = false;
-        this.doNotUpdateVcpkg = false;
-        // Fetch inputs.
-        const vcpkgRootDir = baseUtilLib.baseLib.getPathInput(exports.vcpkgDirectoryInput, false, false);
-        this.vcpkgRootDir = vcpkgRootDir ? path.normalize(path.resolve(vcpkgRootDir)) : null;
-        this.userProvidedCommitId = (_a = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _a !== void 0 ? _a : null;
-        this.runVcpkgFormatString = (_b = baseUtilLib.baseLib.getInput(exports.runVcpkgFormatStringInput, false)) !== null && _b !== void 0 ? _b : null;
-        this.vcpkgJsonGlob = (_c = baseUtilLib.baseLib.getInput(exports.vcpkgJsonGlobInput, false)) !== null && _c !== void 0 ? _c : VcpkgAction.VCPKGJSON_GLOB;
-        this.vcpkgJsonIgnores = eval((_d = baseUtilLib.baseLib.getInput(exports.vcpkgJsonIgnoresInput, false)) !== null && _d !== void 0 ? _d : VcpkgAction.VCPKGJSON_IGNORES);
-        this.vcpkgConfigurationJsonGlob = (_e = baseUtilLib.baseLib.getInput(exports.vcpkgConfigurationJsonGlob, false)) !== null && _e !== void 0 ? _e : null;
-        this.runVcpkgInstall = (_f = baseUtilLib.baseLib.getBoolInput(exports.runVcpkgInstallInput, false)) !== null && _f !== void 0 ? _f : this.runVcpkgInstall;
-        this.doNotCache = (_g = baseUtilLib.baseLib.getBoolInput(exports.doNotCacheInput, false)) !== null && _g !== void 0 ? _g : this.doNotCache;
-        this.doNotUpdateVcpkg = (_h = baseUtilLib.baseLib.getBoolInput(exports.doNotUpdateVcpkgInput, false)) !== null && _h !== void 0 ? _h : this.doNotUpdateVcpkg;
-        this.vcpkgUrl = (_j = baseUtilLib.baseLib.getInput(exports.vcpkgUrlInput, false)) !== null && _j !== void 0 ? _j : VcpkgAction.DEFAULTVCPKGURL;
-        this.vcpkgCommitId = (_k = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _k !== void 0 ? _k : null;
-        this.logCollectionRegExps = (_l = baseUtilLib.baseLib.getDelimitedInput(exports.logCollectionRegExpsInput, ';', false)) !== null && _l !== void 0 ? _l : [];
-        this.binaryCachePath = (_m = baseUtilLib.baseLib.getPathInput(exports.binaryCachePathInput, false, true)) !== null && _m !== void 0 ? _m : null;
-    }
-    run() {
-        return __awaiter(this, void 0, void 0, function* () {
-            const baseLib = this.baseUtilLib.baseLib;
-            baseLib.debug("run()<<");
-            this.vcpkgRootDir = yield this.baseUtilLib.wrapOp('Prepare output directories', () => __awaiter(this, void 0, void 0, function* () {
-                var _a;
-                let vcpkgRoot = this.vcpkgRootDir;
-                // Ensure vcpkg root is set.
-                if (!vcpkgRoot) {
-                    vcpkgRoot = yield runvcpkglib.getDefaultVcpkgDirectory(this.baseUtilLib.baseLib);
-                    baseLib.info(`The vcpkg's root directory is not provided, using the default value: '${this.vcpkgRootDir}'`);
-                }
-                baseLib.info(`The vpckg root directory: '${vcpkgRoot}'`);
-                // Create the vcpkg_root and cache directory if needed.
-                const binCachePath = (_a = this.binaryCachePath) !== null && _a !== void 0 ? _a : yield runvcpkglib.getDefaultVcpkgCacheDirectory(this.baseUtilLib.baseLib);
-                baseLib.debug(`vcpkgRootDir=${this.vcpkgRootDir}, binCachePath=${binCachePath}`);
-                yield baseLib.mkdirP(vcpkgRoot);
-                yield baseLib.mkdirP(binCachePath);
-                // Set the place where vcpkg is putting the binary caching artifacts.
-                this.baseUtilLib.baseLib.setVariable(VcpkgAction.VCPKG_DEFAULT_BINARY_CACHE, binCachePath);
-                return vcpkgRoot;
-            }));
-            if (!this.vcpkgRootDir) {
-                throw new Error(`vcpkgRootDir is not defined!`);
-            }
-            let isCacheHit = null;
-            let cacheKey = null;
-            if (this.doNotCache) {
-                this.baseUtilLib.baseLib.debug(`Skipping restoring vcpkg as caching is disabled. Set input 'doNotCache:false' to enable caching.`);
-            }
-            else {
-                cacheKey =
-                    yield this.baseUtilLib.wrapOp('Computing vcpkg cache key', () => __awaiter(this, void 0, void 0, function* () {
-                        const keys = yield vcpkgutil.Utils.computeCacheKeys(this.baseUtilLib, this.vcpkgRootDir, // HACK: if it were not set it would have thrown before.
-                        this.userProvidedCommitId);
-                        if (keys) {
-                            baseLib.info(`Computed key: ${JSON.stringify(keys)}`);
-                        }
-                        else {
-                            throw new Error("Computation for the cache key failed!");
-                        }
-                        return keys;
-                    }));
-                isCacheHit = yield this.restoreCache(cacheKey);
-            }
-            yield runvcpkglib.VcpkgRunner.run(this.baseUtilLib, this.vcpkgRootDir, this.vcpkgUrl, this.vcpkgCommitId, this.runVcpkgInstall, this.doNotUpdateVcpkg, this.logCollectionRegExps, this.vcpkgJsonGlob, this.vcpkgJsonIgnores, this.vcpkgConfigurationJsonGlob, this.runVcpkgFormatString);
-            if (this.doNotCache) {
-                this.baseUtilLib.baseLib.debug(`Skipping restoring vcpkg as caching is disabled. Set input 'doNotCache:false' to enable caching.`);
-            }
-            else {
-                yield this.saveCache(isCacheHit, cacheKey, // Hack: if it were not set it would have thrown an exception before.
-                vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir // HACK: if it were not set it would have thrown an exception before.
-                ), true);
-            }
-            this.baseUtilLib.baseLib.debug("run()>>");
-        });
-    }
-    restoreCache(keys) {
-        return __awaiter(this, void 0, void 0, function* () {
-            let isCacheHit = false;
-            this.baseUtilLib.baseLib.debug("restoreCache()<<");
-            yield this.baseUtilLib.wrapOp('Restore vcpkg installation from cache (not the packages, that is done by vcpkg via Binary Caching stored onto the GitHub Action cache)', () => __awaiter(this, void 0, void 0, function* () {
-                var _a;
-                if (!this.vcpkgRootDir)
-                    throw new Error("VCPKG_ROOT must be defined");
-                const pathsToCache = vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir);
-                this.baseUtilLib.baseLib.info(`Cache key: '${keys.primary}'`);
-                this.baseUtilLib.baseLib.info(`Cache restore keys: '${keys.restore}'`);
-                this.baseUtilLib.baseLib.info(`Cached paths: '${pathsToCache}'`);
-                let keyCacheHit;
-                try {
-                    keyCacheHit = yield cache.restoreCache(pathsToCache, keys.primary, keys.restore);
-                }
-                catch (err) {
-                    this.baseUtilLib.baseLib.warning(`cache.restoreCache() failed: '${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : "<undefined error>"}', skipping restoring from cache.`);
-                }
-                if (keyCacheHit) {
-                    this.baseUtilLib.baseLib.info(`Cache hit, key = '${keyCacheHit}'.`);
-                    isCacheHit = true;
-                }
-                else {
-                    this.baseUtilLib.baseLib.info(`Cache miss.`);
-                    isCacheHit = false;
-                }
-            }));
-            this.baseUtilLib.baseLib.debug("restoreCache()>>");
-            return isCacheHit;
-        });
-    }
-    saveCache(isCacheHit, keys, cachedPaths, successStep) {
-        return __awaiter(this, void 0, void 0, function* () {
-            this.baseUtilLib.baseLib.debug('saveCache()<<');
-            yield vcpkgutil.Utils.saveCache(this.baseUtilLib, keys, isCacheHit ? keys.primary : null, /* Only the primary cache could have hit, since there are no restore keys. */ cachedPaths);
-            this.baseUtilLib.baseLib.debug('saveCache()>>');
-        });
-    }
-}
-exports.VcpkgAction = VcpkgAction;
-VcpkgAction.VCPKG_DEFAULT_BINARY_CACHE = "VCPKG_DEFAULT_BINARY_CACHE";
-VcpkgAction.VCPKGJSON_GLOB = "**/vcpkg.json";
-VcpkgAction.VCPKGJSON_IGNORES = "['**/vcpkg/**']";
-VcpkgAction.DEFAULTVCPKGURL = 'https://github.com/microsoft/vcpkg.git';
-//# sourceMappingURL=vcpkg-action.js.map
-
-/***/ }),
-
-/***/ 94534:
-/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
-    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
-    return new (P || (P = Promise))(function (resolve, reject) {
-        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
-        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
-        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
-        step((generator = generator.apply(thisArg, _arguments || [])).next());
-    });
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Utils = void 0;
-const path = __nccwpck_require__(71017);
-const fs = __nccwpck_require__(57147);
-const runvcpkglib = __nccwpck_require__(44393);
-const baseutillib = __nccwpck_require__(12365);
-const cache = __nccwpck_require__(27799);
-class Utils {
-    static isExactKeyMatch(key, cacheKey) {
-        if (cacheKey)
-            return cacheKey.localeCompare(key, undefined, { sensitivity: "accent" }) === 0;
-        else
-            return false;
-    }
-    /**
-     * Retrieve the commit id of the Git repository at vcpkgDirectory.
-     * Returns [undefined, undefined] when the provided path is not the root of a Git repository.
-     * @static
-     * @param {baseutillib.BaseUtilLib} baseUtils
-     * @param {string} vcpkgDirectory
-     * @returns {(Promise<[string | undefined, boolean | undefined]>)}
-     * @memberof Utils
-     */
-    static getVcpkgCommitId(baseUtils, vcpkgDirectory) {
-        var _a;
-        return __awaiter(this, void 0, void 0, function* () {
-            baseUtils.baseLib.debug(`getVcpkgCommitId()<<`);
-            let id = undefined;
-            let isSubmodule = undefined;
-            const workspaceDir = (_a = process.env.GITHUB_WORKSPACE) !== null && _a !== void 0 ? _a : "";
-            if (workspaceDir) {
-                let fullVcpkgPath = "";
-                baseUtils.baseLib.debug(`inputVcpkgPath=${vcpkgDirectory}`);
-                if (path.isAbsolute(vcpkgDirectory))
-                    fullVcpkgPath = path.normalize(path.resolve(vcpkgDirectory));
-                else
-                    fullVcpkgPath = path.normalize(path.resolve(path.join(workspaceDir, vcpkgDirectory)));
-                baseUtils.baseLib.debug(`fullVcpkgPath='${fullVcpkgPath}'`);
-                const relPath = fullVcpkgPath.replace(workspaceDir, '');
-                baseUtils.baseLib.debug(`relPath='${relPath}'`);
-                const submodulePath = path.join(workspaceDir, ".git/modules", relPath, "HEAD");
-                baseUtils.baseLib.debug(`submodulePath='${submodulePath}'`);
-                // Check whether it is a submodule.
-                if (fs.existsSync(submodulePath)) {
-                    id = fs.readFileSync(submodulePath).toString();
-                    baseUtils.baseLib.debug(`commitId='${id}'`);
-                    isSubmodule = true;
-                }
-                else if (fs.existsSync(path.join(fullVcpkgPath, ".git"))) {
-                    id = yield runvcpkglib.VcpkgRunner.getCommitId(baseUtils, fullVcpkgPath);
-                    isSubmodule = false;
-                }
-                id = id === null || id === void 0 ? void 0 : id.trim();
-            }
-            baseUtils.baseLib.debug(`getVcpkgCommitId()>> -> [id=${id}, isSubmodule=${isSubmodule}]`);
-            return [id, isSubmodule];
-        });
-    }
-    static computeCacheKeys(baseUtilLib, vcpkgDirectory, userProvidedCommitId) {
-        return __awaiter(this, void 0, void 0, function* () {
-            baseUtilLib.baseLib.debug(`computeCacheKeys()<<`);
-            const cacheKeySegments = [];
-            // Add to the first segment of the key the values of env vars ImageOS and ImageVersion if available.
-            let firstSegment = `runnerOS=${process.env['ImageOS'] ? process.env['ImageOS'] : process.platform}`;
-            firstSegment += process.env['ImageVersion'] || "";
-            const [commitId, isSubmodule] = yield Utils.getVcpkgCommitId(baseUtilLib, vcpkgDirectory);
-            if (commitId) {
-                firstSegment += `-vcpkgGitCommit=${commitId}`;
-                if (isSubmodule) {
-                    baseUtilLib.baseLib.info(`Adding vcpkg submodule Git commit id '${commitId}' to cache key`);
-                    if (userProvidedCommitId) {
-                        baseUtilLib.baseLib.warning(`The provided Git commit id is disregarded: '${userProvidedCommitId}'. Please remove it from the inputs.`);
-                    }
-                }
-                else {
-                    baseUtilLib.baseLib.info(`vcpkg identified at Git commit id '${commitId}', adding it to the cache's key.`);
-                }
-            }
-            else if (userProvidedCommitId) {
-                firstSegment += `-vcpkgGitCommit=${userProvidedCommitId}`;
-                baseUtilLib.baseLib.info(`Adding user provided vcpkg's Git commit id '${userProvidedCommitId}' to cache key.`);
-            }
-            else {
-                baseUtilLib.baseLib.info(`No vcpkg's commit id was provided, does not contribute to the cache's key.`);
-            }
-            cacheKeySegments.push(firstSegment);
-            const keyset = baseutillib.createKeySet(cacheKeySegments);
-            baseUtilLib.baseLib.debug(`computeCacheKeys()>>`);
-            return keyset;
-        });
-    }
-    static saveCache(baseUtilLib, keys, hitCacheKey, cachedPaths) {
-        return __awaiter(this, void 0, void 0, function* () {
-            const baseLib = baseUtilLib.baseLib;
-            baseLib.debug(`saveCache(keys:${JSON.stringify(keys)},hitCacheKey:${hitCacheKey},cachedPaths:${cachedPaths})<<`);
-            try {
-                yield baseUtilLib.wrapOp('Save vcpkg into the GitHub Action cache (only the tool, not the built packages which are saved by vcpkg`s Binary Caching on GitHub Action`s cache).', () => __awaiter(this, void 0, void 0, function* () {
-                    if (hitCacheKey && Utils.isExactKeyMatch(keys.primary, hitCacheKey)) {
-                        baseLib.info(`Saving cache is skipped, because cache hit occurred on the cache key '${keys.primary}'.`);
-                    }
-                    else {
-                        baseLib.info(`Saving a new cache entry, because primary key was missed or a fallback restore key was hit.`);
-                        const pathsToCache = cachedPaths;
-                        baseLib.info(`Caching paths: '${pathsToCache}'`);
-                        try {
-                            baseLib.info(`Saving cache with primary key '${keys.primary}' ...`);
-                            yield cache.saveCache(pathsToCache, keys.primary);
-                        }
-                        catch (error) {
-                            if (error instanceof Error) {
-                                if (error.name === cache.ValidationError.name) {
-                                    throw error;
-                                }
-                                else if (error.name === cache.ReserveCacheError.name) {
-                                    baseLib.info(error.message);
-                                }
-                                else {
-                                    baseLib.warning(error.message);
-                                }
-                            }
-                        }
-                    }
-                }));
-            }
-            catch (err) {
-                baseLib.warning("vcpkg-utils.saveCache() failed!");
-                baseutillib.dumpError(baseLib, err);
-            }
-            baseLib.debug(`saveCache()>>`);
-        });
-    }
-    static getAllCachedPaths(baseLib, vcpkgRootDir) {
-        baseLib.debug(`getAllCachedPaths(${vcpkgRootDir})<<`);
-        let pathsToCache = runvcpkglib.getOrdinaryCachedPaths(vcpkgRootDir);
-        // Remove empty entries.
-        pathsToCache = pathsToCache.map(s => s.trim()).filter(Boolean);
-        // Remove duplicates.
-        const ps = [...new Set(pathsToCache)];
-        baseLib.debug(`getAllCachedPaths(${vcpkgRootDir})<< -> '${JSON.stringify(ps)}'`);
-        return ps;
-    }
-}
-exports.Utils = Utils;
-//# sourceMappingURL=vcpkg-utils.js.map
-
-/***/ }),
-
 /***/ 27799:
 /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 
@@ -114066,6 +113676,396 @@ function wrappy (fn, cb) {
 }).call(this);
 
 
+/***/ }),
+
+/***/ 17672:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+    return new (P || (P = Promise))(function (resolve, reject) {
+        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+        step((generator = generator.apply(thisArg, _arguments || [])).next());
+    });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+const actionlib = __nccwpck_require__(87740);
+const baseUtilLib = __nccwpck_require__(12365);
+const core = __nccwpck_require__(42186);
+const vcpkgAction = __nccwpck_require__(49305);
+const axios_1 = __nccwpck_require__(88757);
+function validateSubscription() {
+    return __awaiter(this, void 0, void 0, function* () {
+        const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
+        try {
+            yield axios_1.default.get(API_URL, { timeout: 3000 });
+        }
+        catch (error) {
+            if ((0, axios_1.isAxiosError)(error) && error.response) {
+                core.error('Subscription is not valid. Reach out to support@stepsecurity.io');
+                process.exit(1);
+            }
+            else {
+                core.info('Timeout or API not reachable. Continuing to next step.');
+            }
+        }
+    });
+}
+function main() {
+    var _a;
+    return __awaiter(this, void 0, void 0, function* () {
+        yield validateSubscription();
+        try {
+            const actionLib = new actionlib.ActionLib();
+            const baseUtil = new baseUtilLib.BaseUtilLib(actionLib);
+            const action = new vcpkgAction.VcpkgAction(baseUtil);
+            yield action.run();
+            core.info('run-vcpkg action execution succeeded');
+            process.exitCode = 0;
+        }
+        catch (err) {
+            const error = err;
+            if (error === null || error === void 0 ? void 0 : error.stack) {
+                core.info(error.stack);
+            }
+            const errorAsString = (_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : "undefined error";
+            core.setFailed(`run-vcpkg action execution failed: ${errorAsString}`);
+            process.exitCode = -1000;
+        }
+    });
+}
+// Main entry point of the task.
+main().catch(error => console.error("main() failed!", error));
+
+
+/***/ }),
+
+/***/ 49305:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+    return new (P || (P = Promise))(function (resolve, reject) {
+        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+        step((generator = generator.apply(thisArg, _arguments || [])).next());
+    });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.VcpkgAction = exports.vcpkgConfigurationJsonGlob = exports.logCollectionRegExpsInput = exports.vcpkgUrlInput = exports.doNotUpdateVcpkgInput = exports.vcpkgCommitIdInput = exports.vcpkgDirectoryInput = exports.runVcpkgFormatStringInput = exports.runVcpkgInstallInput = exports.vcpkgJsonIgnoresInput = exports.vcpkgJsonGlobInput = exports.binaryCachePathInput = exports.additionalCachedPathsInput = exports.doNotCacheInput = void 0;
+const path = __nccwpck_require__(71017);
+const cache = __nccwpck_require__(27799);
+const runvcpkglib = __nccwpck_require__(44393);
+const vcpkgutil = __nccwpck_require__(69863);
+// Input names for run-vcpkg only.
+exports.doNotCacheInput = 'DONOTCACHE';
+exports.additionalCachedPathsInput = 'ADDITIONALCACHEDPATHS';
+exports.binaryCachePathInput = 'BINARYCACHEPATH';
+exports.vcpkgJsonGlobInput = 'VCPKGJSONGLOB';
+exports.vcpkgJsonIgnoresInput = "VCPKGJSONIGNORES";
+exports.runVcpkgInstallInput = 'RUNVCPKGINSTALL';
+exports.runVcpkgFormatStringInput = "RUNVCPKGFORMATSTRING";
+exports.vcpkgDirectoryInput = "VCPKGDIRECTORY";
+exports.vcpkgCommitIdInput = "VCPKGGITCOMMITID";
+exports.doNotUpdateVcpkgInput = "DONOTUPDATEVCPKG";
+exports.vcpkgUrlInput = "VCPKGGITURL";
+exports.logCollectionRegExpsInput = 'LOGCOLLECTIONREGEXPS';
+exports.vcpkgConfigurationJsonGlob = 'VCPKGCONFIGURATIONJSONGLOB';
+class VcpkgAction {
+    constructor(baseUtilLib) {
+        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
+        this.baseUtilLib = baseUtilLib;
+        this.doNotCache = true;
+        this.runVcpkgInstall = false;
+        this.doNotUpdateVcpkg = false;
+        // Fetch inputs.
+        const vcpkgRootDir = baseUtilLib.baseLib.getPathInput(exports.vcpkgDirectoryInput, false, false);
+        this.vcpkgRootDir = vcpkgRootDir ? path.normalize(path.resolve(vcpkgRootDir)) : null;
+        this.userProvidedCommitId = (_a = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _a !== void 0 ? _a : null;
+        this.runVcpkgFormatString = (_b = baseUtilLib.baseLib.getInput(exports.runVcpkgFormatStringInput, false)) !== null && _b !== void 0 ? _b : null;
+        this.vcpkgJsonGlob = (_c = baseUtilLib.baseLib.getInput(exports.vcpkgJsonGlobInput, false)) !== null && _c !== void 0 ? _c : VcpkgAction.VCPKGJSON_GLOB;
+        this.vcpkgJsonIgnores = eval((_d = baseUtilLib.baseLib.getInput(exports.vcpkgJsonIgnoresInput, false)) !== null && _d !== void 0 ? _d : VcpkgAction.VCPKGJSON_IGNORES);
+        this.vcpkgConfigurationJsonGlob = (_e = baseUtilLib.baseLib.getInput(exports.vcpkgConfigurationJsonGlob, false)) !== null && _e !== void 0 ? _e : null;
+        this.runVcpkgInstall = (_f = baseUtilLib.baseLib.getBoolInput(exports.runVcpkgInstallInput, false)) !== null && _f !== void 0 ? _f : this.runVcpkgInstall;
+        this.doNotCache = (_g = baseUtilLib.baseLib.getBoolInput(exports.doNotCacheInput, false)) !== null && _g !== void 0 ? _g : this.doNotCache;
+        this.doNotUpdateVcpkg = (_h = baseUtilLib.baseLib.getBoolInput(exports.doNotUpdateVcpkgInput, false)) !== null && _h !== void 0 ? _h : this.doNotUpdateVcpkg;
+        this.vcpkgUrl = (_j = baseUtilLib.baseLib.getInput(exports.vcpkgUrlInput, false)) !== null && _j !== void 0 ? _j : VcpkgAction.DEFAULTVCPKGURL;
+        this.vcpkgCommitId = (_k = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _k !== void 0 ? _k : null;
+        this.logCollectionRegExps = (_l = baseUtilLib.baseLib.getDelimitedInput(exports.logCollectionRegExpsInput, ';', false)) !== null && _l !== void 0 ? _l : [];
+        this.binaryCachePath = (_m = baseUtilLib.baseLib.getPathInput(exports.binaryCachePathInput, false, true)) !== null && _m !== void 0 ? _m : null;
+    }
+    run() {
+        return __awaiter(this, void 0, void 0, function* () {
+            const baseLib = this.baseUtilLib.baseLib;
+            baseLib.debug("run()<<");
+            this.vcpkgRootDir = yield this.baseUtilLib.wrapOp('Prepare output directories', () => __awaiter(this, void 0, void 0, function* () {
+                var _a;
+                let vcpkgRoot = this.vcpkgRootDir;
+                // Ensure vcpkg root is set.
+                if (!vcpkgRoot) {
+                    vcpkgRoot = yield runvcpkglib.getDefaultVcpkgDirectory(this.baseUtilLib.baseLib);
+                    baseLib.info(`The vcpkg's root directory is not provided, using the default value: '${this.vcpkgRootDir}'`);
+                }
+                baseLib.info(`The vpckg root directory: '${vcpkgRoot}'`);
+                // Create the vcpkg_root and cache directory if needed.
+                const binCachePath = (_a = this.binaryCachePath) !== null && _a !== void 0 ? _a : yield runvcpkglib.getDefaultVcpkgCacheDirectory(this.baseUtilLib.baseLib);
+                baseLib.debug(`vcpkgRootDir=${this.vcpkgRootDir}, binCachePath=${binCachePath}`);
+                yield baseLib.mkdirP(vcpkgRoot);
+                yield baseLib.mkdirP(binCachePath);
+                // Set the place where vcpkg is putting the binary caching artifacts.
+                this.baseUtilLib.baseLib.setVariable(VcpkgAction.VCPKG_DEFAULT_BINARY_CACHE, binCachePath);
+                return vcpkgRoot;
+            }));
+            if (!this.vcpkgRootDir) {
+                throw new Error(`vcpkgRootDir is not defined!`);
+            }
+            let isCacheHit = null;
+            let cacheKey = null;
+            if (this.doNotCache) {
+                this.baseUtilLib.baseLib.debug(`Skipping restoring vcpkg as caching is disabled. Set input 'doNotCache:false' to enable caching.`);
+            }
+            else {
+                cacheKey =
+                    yield this.baseUtilLib.wrapOp('Computing vcpkg cache key', () => __awaiter(this, void 0, void 0, function* () {
+                        const keys = yield vcpkgutil.Utils.computeCacheKeys(this.baseUtilLib, this.vcpkgRootDir, // HACK: if it were not set it would have thrown before.
+                        this.userProvidedCommitId);
+                        if (keys) {
+                            baseLib.info(`Computed key: ${JSON.stringify(keys)}`);
+                        }
+                        else {
+                            throw new Error("Computation for the cache key failed!");
+                        }
+                        return keys;
+                    }));
+                isCacheHit = yield this.restoreCache(cacheKey);
+            }
+            yield runvcpkglib.VcpkgRunner.run(this.baseUtilLib, this.vcpkgRootDir, this.vcpkgUrl, this.vcpkgCommitId, this.runVcpkgInstall, this.doNotUpdateVcpkg, this.logCollectionRegExps, this.vcpkgJsonGlob, this.vcpkgJsonIgnores, this.vcpkgConfigurationJsonGlob, this.runVcpkgFormatString);
+            if (this.doNotCache) {
+                this.baseUtilLib.baseLib.debug(`Skipping restoring vcpkg as caching is disabled. Set input 'doNotCache:false' to enable caching.`);
+            }
+            else {
+                yield this.saveCache(isCacheHit, cacheKey, // Hack: if it were not set it would have thrown an exception before.
+                vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir // HACK: if it were not set it would have thrown an exception before.
+                ), true);
+            }
+            this.baseUtilLib.baseLib.debug("run()>>");
+        });
+    }
+    restoreCache(keys) {
+        return __awaiter(this, void 0, void 0, function* () {
+            let isCacheHit = false;
+            this.baseUtilLib.baseLib.debug("restoreCache()<<");
+            yield this.baseUtilLib.wrapOp('Restore vcpkg installation from cache (not the packages, that is done by vcpkg via Binary Caching stored onto the GitHub Action cache)', () => __awaiter(this, void 0, void 0, function* () {
+                var _a;
+                if (!this.vcpkgRootDir)
+                    throw new Error("VCPKG_ROOT must be defined");
+                const pathsToCache = vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir);
+                this.baseUtilLib.baseLib.info(`Cache key: '${keys.primary}'`);
+                this.baseUtilLib.baseLib.info(`Cache restore keys: '${keys.restore}'`);
+                this.baseUtilLib.baseLib.info(`Cached paths: '${pathsToCache}'`);
+                let keyCacheHit;
+                try {
+                    keyCacheHit = yield cache.restoreCache(pathsToCache, keys.primary, keys.restore);
+                }
+                catch (err) {
+                    this.baseUtilLib.baseLib.warning(`cache.restoreCache() failed: '${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : "<undefined error>"}', skipping restoring from cache.`);
+                }
+                if (keyCacheHit) {
+                    this.baseUtilLib.baseLib.info(`Cache hit, key = '${keyCacheHit}'.`);
+                    isCacheHit = true;
+                }
+                else {
+                    this.baseUtilLib.baseLib.info(`Cache miss.`);
+                    isCacheHit = false;
+                }
+            }));
+            this.baseUtilLib.baseLib.debug("restoreCache()>>");
+            return isCacheHit;
+        });
+    }
+    saveCache(isCacheHit, keys, cachedPaths, successStep) {
+        return __awaiter(this, void 0, void 0, function* () {
+            this.baseUtilLib.baseLib.debug('saveCache()<<');
+            yield vcpkgutil.Utils.saveCache(this.baseUtilLib, keys, isCacheHit ? keys.primary : null, /* Only the primary cache could have hit, since there are no restore keys. */ cachedPaths);
+            this.baseUtilLib.baseLib.debug('saveCache()>>');
+        });
+    }
+}
+exports.VcpkgAction = VcpkgAction;
+VcpkgAction.VCPKG_DEFAULT_BINARY_CACHE = "VCPKG_DEFAULT_BINARY_CACHE";
+VcpkgAction.VCPKGJSON_GLOB = "**/vcpkg.json";
+VcpkgAction.VCPKGJSON_IGNORES = "['**/vcpkg/**']";
+VcpkgAction.DEFAULTVCPKGURL = 'https://github.com/microsoft/vcpkg.git';
+
+
+/***/ }),
+
+/***/ 69863:
+/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
+
+"use strict";
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+    return new (P || (P = Promise))(function (resolve, reject) {
+        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+        step((generator = generator.apply(thisArg, _arguments || [])).next());
+    });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.Utils = void 0;
+const path = __nccwpck_require__(71017);
+const fs = __nccwpck_require__(57147);
+const runvcpkglib = __nccwpck_require__(44393);
+const baseutillib = __nccwpck_require__(12365);
+const cache = __nccwpck_require__(27799);
+class Utils {
+    static isExactKeyMatch(key, cacheKey) {
+        if (cacheKey)
+            return cacheKey.localeCompare(key, undefined, { sensitivity: "accent" }) === 0;
+        else
+            return false;
+    }
+    /**
+     * Retrieve the commit id of the Git repository at vcpkgDirectory.
+     * Returns [undefined, undefined] when the provided path is not the root of a Git repository.
+     * @static
+     * @param {baseutillib.BaseUtilLib} baseUtils
+     * @param {string} vcpkgDirectory
+     * @returns {(Promise<[string | undefined, boolean | undefined]>)}
+     * @memberof Utils
+     */
+    static getVcpkgCommitId(baseUtils, vcpkgDirectory) {
+        var _a;
+        return __awaiter(this, void 0, void 0, function* () {
+            baseUtils.baseLib.debug(`getVcpkgCommitId()<<`);
+            let id = undefined;
+            let isSubmodule = undefined;
+            const workspaceDir = (_a = process.env.GITHUB_WORKSPACE) !== null && _a !== void 0 ? _a : "";
+            if (workspaceDir) {
+                let fullVcpkgPath = "";
+                baseUtils.baseLib.debug(`inputVcpkgPath=${vcpkgDirectory}`);
+                if (path.isAbsolute(vcpkgDirectory))
+                    fullVcpkgPath = path.normalize(path.resolve(vcpkgDirectory));
+                else
+                    fullVcpkgPath = path.normalize(path.resolve(path.join(workspaceDir, vcpkgDirectory)));
+                baseUtils.baseLib.debug(`fullVcpkgPath='${fullVcpkgPath}'`);
+                const relPath = fullVcpkgPath.replace(workspaceDir, '');
+                baseUtils.baseLib.debug(`relPath='${relPath}'`);
+                const submodulePath = path.join(workspaceDir, ".git/modules", relPath, "HEAD");
+                baseUtils.baseLib.debug(`submodulePath='${submodulePath}'`);
+                // Check whether it is a submodule.
+                if (fs.existsSync(submodulePath)) {
+                    id = fs.readFileSync(submodulePath).toString();
+                    baseUtils.baseLib.debug(`commitId='${id}'`);
+                    isSubmodule = true;
+                }
+                else if (fs.existsSync(path.join(fullVcpkgPath, ".git"))) {
+                    id = yield runvcpkglib.VcpkgRunner.getCommitId(baseUtils, fullVcpkgPath);
+                    isSubmodule = false;
+                }
+                id = id === null || id === void 0 ? void 0 : id.trim();
+            }
+            baseUtils.baseLib.debug(`getVcpkgCommitId()>> -> [id=${id}, isSubmodule=${isSubmodule}]`);
+            return [id, isSubmodule];
+        });
+    }
+    static computeCacheKeys(baseUtilLib, vcpkgDirectory, userProvidedCommitId) {
+        return __awaiter(this, void 0, void 0, function* () {
+            baseUtilLib.baseLib.debug(`computeCacheKeys()<<`);
+            const cacheKeySegments = [];
+            // Add to the first segment of the key the values of env vars ImageOS and ImageVersion if available.
+            let firstSegment = `runnerOS=${process.env['ImageOS'] ? process.env['ImageOS'] : process.platform}`;
+            firstSegment += process.env['ImageVersion'] || "";
+            const [commitId, isSubmodule] = yield Utils.getVcpkgCommitId(baseUtilLib, vcpkgDirectory);
+            if (commitId) {
+                firstSegment += `-vcpkgGitCommit=${commitId}`;
+                if (isSubmodule) {
+                    baseUtilLib.baseLib.info(`Adding vcpkg submodule Git commit id '${commitId}' to cache key`);
+                    if (userProvidedCommitId) {
+                        baseUtilLib.baseLib.warning(`The provided Git commit id is disregarded: '${userProvidedCommitId}'. Please remove it from the inputs.`);
+                    }
+                }
+                else {
+                    baseUtilLib.baseLib.info(`vcpkg identified at Git commit id '${commitId}', adding it to the cache's key.`);
+                }
+            }
+            else if (userProvidedCommitId) {
+                firstSegment += `-vcpkgGitCommit=${userProvidedCommitId}`;
+                baseUtilLib.baseLib.info(`Adding user provided vcpkg's Git commit id '${userProvidedCommitId}' to cache key.`);
+            }
+            else {
+                baseUtilLib.baseLib.info(`No vcpkg's commit id was provided, does not contribute to the cache's key.`);
+            }
+            cacheKeySegments.push(firstSegment);
+            const keyset = baseutillib.createKeySet(cacheKeySegments);
+            baseUtilLib.baseLib.debug(`computeCacheKeys()>>`);
+            return keyset;
+        });
+    }
+    static saveCache(baseUtilLib, keys, hitCacheKey, cachedPaths) {
+        return __awaiter(this, void 0, void 0, function* () {
+            const baseLib = baseUtilLib.baseLib;
+            baseLib.debug(`saveCache(keys:${JSON.stringify(keys)},hitCacheKey:${hitCacheKey},cachedPaths:${cachedPaths})<<`);
+            try {
+                yield baseUtilLib.wrapOp('Save vcpkg into the GitHub Action cache (only the tool, not the built packages which are saved by vcpkg`s Binary Caching on GitHub Action`s cache).', () => __awaiter(this, void 0, void 0, function* () {
+                    if (hitCacheKey && Utils.isExactKeyMatch(keys.primary, hitCacheKey)) {
+                        baseLib.info(`Saving cache is skipped, because cache hit occurred on the cache key '${keys.primary}'.`);
+                    }
+                    else {
+                        baseLib.info(`Saving a new cache entry, because primary key was missed or a fallback restore key was hit.`);
+                        const pathsToCache = cachedPaths;
+                        baseLib.info(`Caching paths: '${pathsToCache}'`);
+                        try {
+                            baseLib.info(`Saving cache with primary key '${keys.primary}' ...`);
+                            yield cache.saveCache(pathsToCache, keys.primary);
+                        }
+                        catch (error) {
+                            if (error instanceof Error) {
+                                if (error.name === cache.ValidationError.name) {
+                                    throw error;
+                                }
+                                else if (error.name === cache.ReserveCacheError.name) {
+                                    baseLib.info(error.message);
+                                }
+                                else {
+                                    baseLib.warning(error.message);
+                                }
+                            }
+                        }
+                    }
+                }));
+            }
+            catch (err) {
+                baseLib.warning("vcpkg-utils.saveCache() failed!");
+                baseutillib.dumpError(baseLib, err);
+            }
+            baseLib.debug(`saveCache()>>`);
+        });
+    }
+    static getAllCachedPaths(baseLib, vcpkgRootDir) {
+        baseLib.debug(`getAllCachedPaths(${vcpkgRootDir})<<`);
+        let pathsToCache = runvcpkglib.getOrdinaryCachedPaths(vcpkgRootDir);
+        // Remove empty entries.
+        pathsToCache = pathsToCache.map(s => s.trim()).filter(Boolean);
+        // Remove duplicates.
+        const ps = [...new Set(pathsToCache)];
+        baseLib.debug(`getAllCachedPaths(${vcpkgRootDir})<< -> '${JSON.stringify(ps)}'`);
+        return ps;
+    }
+}
+exports.Utils = Utils;
+
+
 /***/ }),
 
 /***/ 22877:
@@ -119275,7 +119275,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
 /******/ 	// startup
 /******/ 	// Load entry module and return exports
 /******/ 	// This entry module is referenced by other modules so it can't be inlined
-/******/ 	var __webpack_exports__ = __nccwpck_require__(43761);
+/******/ 	var __webpack_exports__ = __nccwpck_require__(17672);
 /******/ 	module.exports = __webpack_exports__;
 /******/ 	
 /******/ })()
diff --git a/package.json b/package.json
index e0dac1e..f9e7e18 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
     "pre-build": "npm run deployAssets && npx tsc",
     "lint": "npx eslint .",
     "test": "npx jest",
-    "build": "npx ncc build build/src/action.js -o dist",
+    "build": "npx ncc build src/action.ts -o dist",
     "repack": "npm run build && npm run deployAssets && npm run lint && npm run pack"
   },
   "devDependencies": {