diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index daba0bc..8ffbe81 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -12,22 +12,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2
-
- - uses: bgd-labs/github-workflows/.github/actions/setup-node@main
-
- - name: test lib
- run: npm test -- --run
-
- name: test action
id: gas
uses: ./
with:
- ROOT_REPORT_PATH: "mocks/gas.backup.json"
- REPORT_PATH: "mocks/gas.json"
+ token: ${{ secrets.GITHUB_TOKEN }}
+ files: |
+ package.json
+ mocks/*.json
- name: Prepare comment
run: |
- printf '%s' "${{ steps.gas.outputs.gas-report }}" > /tmp/template.md
+ printf '%s' "${{ steps.gas.outputs.report }}" > /tmp/template.md
- name: Find Comment
uses: peter-evans/find-comment@v3
diff --git a/action.yml b/action.yml
index d3415da..c297fb9 100644
--- a/action.yml
+++ b/action.yml
@@ -1,20 +1,22 @@
name: "foundry-gas-report"
-description: "Generates a html gas report diffing two json gas-report files"
+description: "Generates a report about differences between two JSON files."
inputs:
- ROOT_REPORT_PATH:
- description: "The path to the gas report to diff against. If empty it will not diff, but just pretty print the report."
- required: false
- REPORT_PATH:
- description: "The path to the gas report."
+ token:
+ description: "The GitHub token to use for the API requests."
required: true
- ignoreUnchanged:
- description: "If true, the diff will ignore unchanged items."
+ files:
+ description: "The files that should be compared. A glob is accepted."
+ required: false
+ default: |
+ snapshots/*.json
+ baseBranch:
+ description: "The base branch to compare against."
required: false
- default: "false"
+ default: "main"
outputs:
report:
- description: "The html gas report"
+ description: "The report"
runs:
using: "node20"
diff --git a/dist/action.js b/dist/action.js
index cb2242f..444d9a8 100644
--- a/dist/action.js
+++ b/dist/action.js
@@ -411,7 +411,7 @@ var require_tunnel = __commonJS({
connectOptions.headers = connectOptions.headers || {};
connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64");
}
- debug("making CONNECT request");
+ debug2("making CONNECT request");
var connectReq = self.request(connectOptions);
connectReq.useChunkedEncodingByDefault = false;
connectReq.once("response", onResponse);
@@ -431,7 +431,7 @@ var require_tunnel = __commonJS({
connectReq.removeAllListeners();
socket.removeAllListeners();
if (res.statusCode !== 200) {
- debug(
+ debug2(
"tunneling socket could not be established, statusCode=%d",
res.statusCode
);
@@ -443,7 +443,7 @@ var require_tunnel = __commonJS({
return;
}
if (head.length > 0) {
- debug("got illegal response body from proxy");
+ debug2("got illegal response body from proxy");
socket.destroy();
var error = new Error("got illegal response body from proxy");
error.code = "ECONNRESET";
@@ -451,13 +451,13 @@ var require_tunnel = __commonJS({
self.removeSocket(placeholder);
return;
}
- debug("tunneling connection has established");
+ debug2("tunneling connection has established");
self.sockets[self.sockets.indexOf(placeholder)] = socket;
return cb(socket);
}
function onError(cause) {
connectReq.removeAllListeners();
- debug(
+ debug2(
"tunneling socket could not be established, cause=%s\n",
cause.message,
cause.stack
@@ -519,9 +519,9 @@ var require_tunnel = __commonJS({
}
return target;
}
- var debug;
+ var debug2;
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
- debug = function() {
+ debug2 = function() {
var args = Array.prototype.slice.call(arguments);
if (typeof args[0] === "string") {
args[0] = "TUNNEL: " + args[0];
@@ -531,10 +531,10 @@ var require_tunnel = __commonJS({
console.error.apply(console, args);
};
} else {
- debug = function() {
+ debug2 = function() {
};
}
- exports2.debug = debug;
+ exports2.debug = debug2;
}
});
@@ -4154,7 +4154,7 @@ var require_util2 = __commonJS({
if (input.length < MAXIMUM_ARGUMENT_LENGTH) {
return String.fromCharCode(...input);
}
- return input.reduce((previous, current2) => previous + String.fromCharCode(current2), "");
+ return input.reduce((previous, current) => previous + String.fromCharCode(current), "");
}
function readableStreamClose(controller) {
try {
@@ -11229,8 +11229,8 @@ var require_RetryHandler = __commonJS({
var { RequestRetryError } = require_errors();
var { isDisturbed, parseHeaders, parseRangeHeader } = require_util();
function calculateRetryAfterHeader(retryAfter) {
- const current2 = Date.now();
- const diff = new Date(retryAfter).getTime() - current2;
+ const current = Date.now();
+ const diff = new Date(retryAfter).getTime() - current;
return diff;
}
var RetryHandler = class _RetryHandler {
@@ -19781,10 +19781,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
return process.env["RUNNER_DEBUG"] === "1";
}
exports2.isDebug = isDebug;
- function debug(message) {
+ function debug2(message) {
(0, command_1.issueCommand)("debug", {}, message);
}
- exports2.debug = debug;
+ exports2.debug = debug2;
function error(message, properties = {}) {
(0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
}
@@ -23333,15 +23333,15 @@ var init_endpoints = __esm({
});
// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
-function endpointsToMethods(octokit) {
+function endpointsToMethods(octokit2) {
const newMethods = {};
for (const scope of endpointMethodsMap.keys()) {
- newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
+ newMethods[scope] = new Proxy({ octokit: octokit2, scope, cache: {} }, handler);
}
return newMethods;
}
-function decorate(octokit, scope, methodName, defaults, decorations) {
- const requestWithDefaults = octokit.request.defaults(defaults);
+function decorate(octokit2, scope, methodName, defaults, decorations) {
+ const requestWithDefaults = octokit2.request.defaults(defaults);
function withDecorations(...args) {
let options = requestWithDefaults.endpoint.merge(...args);
if (decorations.mapToData) {
@@ -23353,12 +23353,12 @@ function decorate(octokit, scope, methodName, defaults, decorations) {
}
if (decorations.renamed) {
const [newScope, newMethodName] = decorations.renamed;
- octokit.log.warn(
+ octokit2.log.warn(
`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
);
}
if (decorations.deprecated) {
- octokit.log.warn(decorations.deprecated);
+ octokit2.log.warn(decorations.deprecated);
}
if (decorations.renamedParameters) {
const options2 = requestWithDefaults.endpoint.merge(...args);
@@ -23366,7 +23366,7 @@ function decorate(octokit, scope, methodName, defaults, decorations) {
decorations.renamedParameters
)) {
if (name in options2) {
- octokit.log.warn(
+ octokit2.log.warn(
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
);
if (!(alias in options2)) {
@@ -23436,7 +23436,7 @@ var init_endpoints_to_methods = __esm({
set(target, methodName, value) {
return target.cache[methodName] = value;
},
- get({ octokit, scope, cache }, methodName) {
+ get({ octokit: octokit2, scope, cache }, methodName) {
if (cache[methodName]) {
return cache[methodName];
}
@@ -23447,14 +23447,14 @@ var init_endpoints_to_methods = __esm({
const { endpointDefaults, decorations } = method;
if (decorations) {
cache[methodName] = decorate(
- octokit,
+ octokit2,
scope,
methodName,
endpointDefaults,
decorations
);
} else {
- cache[methodName] = octokit.request.defaults(endpointDefaults);
+ cache[methodName] = octokit2.request.defaults(endpointDefaults);
}
return cache[methodName];
}
@@ -23468,14 +23468,14 @@ __export(dist_src_exports, {
legacyRestEndpointMethods: () => legacyRestEndpointMethods,
restEndpointMethods: () => restEndpointMethods
});
-function restEndpointMethods(octokit) {
- const api = endpointsToMethods(octokit);
+function restEndpointMethods(octokit2) {
+ const api = endpointsToMethods(octokit2);
return {
rest: api
};
}
-function legacyRestEndpointMethods(octokit) {
- const api = endpointsToMethods(octokit);
+function legacyRestEndpointMethods(octokit2) {
+ const api = endpointsToMethods(octokit2);
return {
...api,
rest: api
@@ -23527,9 +23527,9 @@ function normalizePaginatedListResponse(response) {
response.data.total_count = totalCount;
return response;
}
-function iterator(octokit, route, parameters) {
- const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
- const requestMethod = typeof route === "function" ? route : octokit.request;
+function iterator(octokit2, route, parameters) {
+ const options = typeof route === "function" ? route.endpoint(parameters) : octokit2.request.endpoint(route, parameters);
+ const requestMethod = typeof route === "function" ? route : octokit2.request;
const method = options.method;
const headers = options.headers;
let url = options.url;
@@ -23561,19 +23561,19 @@ function iterator(octokit, route, parameters) {
})
};
}
-function paginate(octokit, route, parameters, mapFn) {
+function paginate(octokit2, route, parameters, mapFn) {
if (typeof parameters === "function") {
mapFn = parameters;
parameters = void 0;
}
return gather(
- octokit,
+ octokit2,
[],
- iterator(octokit, route, parameters)[Symbol.asyncIterator](),
+ iterator(octokit2, route, parameters)[Symbol.asyncIterator](),
mapFn
);
}
-function gather(octokit, results, iterator2, mapFn) {
+function gather(octokit2, results, iterator2, mapFn) {
return iterator2.next().then((result) => {
if (result.done) {
return results;
@@ -23588,7 +23588,7 @@ function gather(octokit, results, iterator2, mapFn) {
if (earlyExit) {
return results;
}
- return gather(octokit, results, iterator2, mapFn);
+ return gather(octokit2, results, iterator2, mapFn);
});
}
function isPaginatingEndpoint(arg) {
@@ -23598,10 +23598,10 @@ function isPaginatingEndpoint(arg) {
return false;
}
}
-function paginateRest(octokit) {
+function paginateRest(octokit2) {
return {
- paginate: Object.assign(paginate.bind(null, octokit), {
- iterator: iterator.bind(null, octokit)
+ paginate: Object.assign(paginate.bind(null, octokit2), {
+ iterator: iterator.bind(null, octokit2)
})
};
}
@@ -23949,92 +23949,1920 @@ var require_github = __commonJS({
var Context = __importStar(require_context());
var utils_1 = require_utils4();
exports2.context = new Context.Context();
- function getOctokit(token, options, ...additionalPlugins) {
+ function getOctokit2(token, options, ...additionalPlugins) {
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
}
- exports2.getOctokit = getOctokit;
+ exports2.getOctokit = getOctokit2;
}
});
-// src/action.ts
-var import_fs = require("fs");
-var import_core = __toESM(require_core());
-var import_github = __toESM(require_github());
+// node_modules/@actions/glob/lib/internal-glob-options-helper.js
+var require_internal_glob_options_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-glob-options-helper.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.getOptions = void 0;
+ var core = __importStar(require_core());
+ function getOptions(copy) {
+ const result = {
+ followSymbolicLinks: true,
+ implicitDescendants: true,
+ matchDirectories: true,
+ omitBrokenSymbolicLinks: true,
+ excludeHiddenFiles: false
+ };
+ if (copy) {
+ if (typeof copy.followSymbolicLinks === "boolean") {
+ result.followSymbolicLinks = copy.followSymbolicLinks;
+ core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`);
+ }
+ if (typeof copy.implicitDescendants === "boolean") {
+ result.implicitDescendants = copy.implicitDescendants;
+ core.debug(`implicitDescendants '${result.implicitDescendants}'`);
+ }
+ if (typeof copy.matchDirectories === "boolean") {
+ result.matchDirectories = copy.matchDirectories;
+ core.debug(`matchDirectories '${result.matchDirectories}'`);
+ }
+ if (typeof copy.omitBrokenSymbolicLinks === "boolean") {
+ result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
+ core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
+ }
+ if (typeof copy.excludeHiddenFiles === "boolean") {
+ result.excludeHiddenFiles = copy.excludeHiddenFiles;
+ core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
+ }
+ }
+ return result;
+ }
+ exports2.getOptions = getOptions;
+ }
+});
-// src/lib.ts
-var UP = `\u2191`;
-var DOWN = `\u2193`;
-function findContract(contract, snapshot) {
- return snapshot.find((item) => item.contract === contract);
-}
-function findFunction(fn, snapshot) {
- return snapshot[fn];
-}
-function formatValue(before, after) {
- if (!before || after === before) return after;
- const diff = (after - before) / Math.abs(before) * 100;
- if (Math.abs(diff) < 0.1) return after;
- return `${diff > 0 ? UP : DOWN}${new Intl.NumberFormat(
- "en-US",
- {
- maximumSignificantDigits: 2
- }
- ).format(diff)}%${after}`;
-}
-function getHtmlGasReport(before, after, options = {}) {
- let content = "";
- after.map((item) => {
- const contractBefore = findContract(item.contract, before);
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item) === JSON.stringify(contractBefore))
- return;
- const [path, name] = item.contract.split(":");
- content += `### [${name}](${options.rootUrl}${path})
+// node_modules/@actions/glob/lib/internal-path-helper.js
+var require_internal_path_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-path-helper.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.safeTrimTrailingSeparator = exports2.normalizeSeparators = exports2.hasRoot = exports2.hasAbsoluteRoot = exports2.ensureAbsoluteRoot = exports2.dirname = void 0;
+ var path = __importStar(require("path"));
+ var assert_1 = __importDefault(require("assert"));
+ var IS_WINDOWS = process.platform === "win32";
+ function dirname(p) {
+ p = safeTrimTrailingSeparator(p);
+ if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
+ return p;
+ }
+ let result = path.dirname(p);
+ if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
+ result = safeTrimTrailingSeparator(result);
+ }
+ return result;
+ }
+ exports2.dirname = dirname;
+ function ensureAbsoluteRoot(root, itemPath) {
+ (0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
+ (0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
+ if (hasAbsoluteRoot(itemPath)) {
+ return itemPath;
+ }
+ if (IS_WINDOWS) {
+ if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
+ let cwd = process.cwd();
+ (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
+ if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
+ if (itemPath.length === 2) {
+ return `${itemPath[0]}:\\${cwd.substr(3)}`;
+ } else {
+ if (!cwd.endsWith("\\")) {
+ cwd += "\\";
+ }
+ return `${itemPath[0]}:\\${cwd.substr(3)}${itemPath.substr(2)}`;
+ }
+ } else {
+ return `${itemPath[0]}:\\${itemPath.substr(2)}`;
+ }
+ } else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
+ const cwd = process.cwd();
+ (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
+ return `${cwd[0]}:\\${itemPath.substr(1)}`;
+ }
+ }
+ (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
+ if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) {
+ } else {
+ root += path.sep;
+ }
+ return root + itemPath;
+ }
+ exports2.ensureAbsoluteRoot = ensureAbsoluteRoot;
+ function hasAbsoluteRoot(itemPath) {
+ (0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
+ itemPath = normalizeSeparators(itemPath);
+ if (IS_WINDOWS) {
+ return itemPath.startsWith("\\\\") || /^[A-Z]:\\/i.test(itemPath);
+ }
+ return itemPath.startsWith("/");
+ }
+ exports2.hasAbsoluteRoot = hasAbsoluteRoot;
+ function hasRoot(itemPath) {
+ (0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
+ itemPath = normalizeSeparators(itemPath);
+ if (IS_WINDOWS) {
+ return itemPath.startsWith("\\") || /^[A-Z]:/i.test(itemPath);
+ }
+ return itemPath.startsWith("/");
+ }
+ exports2.hasRoot = hasRoot;
+ function normalizeSeparators(p) {
+ p = p || "";
+ if (IS_WINDOWS) {
+ p = p.replace(/\//g, "\\");
+ const isUnc = /^\\\\+[^\\]/.test(p);
+ return (isUnc ? "\\" : "") + p.replace(/\\\\+/g, "\\");
+ }
+ return p.replace(/\/\/+/g, "/");
+ }
+ exports2.normalizeSeparators = normalizeSeparators;
+ function safeTrimTrailingSeparator(p) {
+ if (!p) {
+ return "";
+ }
+ p = normalizeSeparators(p);
+ if (!p.endsWith(path.sep)) {
+ return p;
+ }
+ if (p === path.sep) {
+ return p;
+ }
+ if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) {
+ return p;
+ }
+ return p.substr(0, p.length - 1);
+ }
+ exports2.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-match-kind.js
+var require_internal_match_kind = __commonJS({
+ "node_modules/@actions/glob/lib/internal-match-kind.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.MatchKind = void 0;
+ var MatchKind;
+ (function(MatchKind2) {
+ MatchKind2[MatchKind2["None"] = 0] = "None";
+ MatchKind2[MatchKind2["Directory"] = 1] = "Directory";
+ MatchKind2[MatchKind2["File"] = 2] = "File";
+ MatchKind2[MatchKind2["All"] = 3] = "All";
+ })(MatchKind || (exports2.MatchKind = MatchKind = {}));
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-pattern-helper.js
+var require_internal_pattern_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-pattern-helper.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.partialMatch = exports2.match = exports2.getSearchPaths = void 0;
+ var pathHelper = __importStar(require_internal_path_helper());
+ var internal_match_kind_1 = require_internal_match_kind();
+ var IS_WINDOWS = process.platform === "win32";
+ function getSearchPaths(patterns) {
+ patterns = patterns.filter((x) => !x.negate);
+ const searchPathMap = {};
+ for (const pattern of patterns) {
+ const key = IS_WINDOWS ? pattern.searchPath.toUpperCase() : pattern.searchPath;
+ searchPathMap[key] = "candidate";
+ }
+ const result = [];
+ for (const pattern of patterns) {
+ const key = IS_WINDOWS ? pattern.searchPath.toUpperCase() : pattern.searchPath;
+ if (searchPathMap[key] === "included") {
+ continue;
+ }
+ let foundAncestor = false;
+ let tempKey = key;
+ let parent = pathHelper.dirname(tempKey);
+ while (parent !== tempKey) {
+ if (searchPathMap[parent]) {
+ foundAncestor = true;
+ break;
+ }
+ tempKey = parent;
+ parent = pathHelper.dirname(tempKey);
+ }
+ if (!foundAncestor) {
+ result.push(pattern.searchPath);
+ searchPathMap[key] = "included";
+ }
+ }
+ return result;
+ }
+ exports2.getSearchPaths = getSearchPaths;
+ function match(patterns, itemPath) {
+ let result = internal_match_kind_1.MatchKind.None;
+ for (const pattern of patterns) {
+ if (pattern.negate) {
+ result &= ~pattern.match(itemPath);
+ } else {
+ result |= pattern.match(itemPath);
+ }
+ }
+ return result;
+ }
+ exports2.match = match;
+ function partialMatch(patterns, itemPath) {
+ return patterns.some((x) => !x.negate && x.partialMatch(itemPath));
+ }
+ exports2.partialMatch = partialMatch;
+ }
+});
+
+// node_modules/concat-map/index.js
+var require_concat_map = __commonJS({
+ "node_modules/concat-map/index.js"(exports2, module2) {
+ "use strict";
+ module2.exports = function(xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ var x = fn(xs[i], i);
+ if (isArray(x)) res.push.apply(res, x);
+ else res.push(x);
+ }
+ return res;
+ };
+ var isArray = Array.isArray || function(xs) {
+ return Object.prototype.toString.call(xs) === "[object Array]";
+ };
+ }
+});
+
+// node_modules/balanced-match/index.js
+var require_balanced_match = __commonJS({
+ "node_modules/balanced-match/index.js"(exports2, module2) {
+ "use strict";
+ module2.exports = balanced;
+ function balanced(a, b, str) {
+ if (a instanceof RegExp) a = maybeMatch(a, str);
+ if (b instanceof RegExp) b = maybeMatch(b, str);
+ var r = range(a, b, str);
+ return r && {
+ start: r[0],
+ end: r[1],
+ pre: str.slice(0, r[0]),
+ body: str.slice(r[0] + a.length, r[1]),
+ post: str.slice(r[1] + b.length)
+ };
+ }
+ function maybeMatch(reg, str) {
+ var m = str.match(reg);
+ return m ? m[0] : null;
+ }
+ balanced.range = range;
+ function range(a, b, str) {
+ var begs, beg, left, right, result;
+ var ai = str.indexOf(a);
+ var bi = str.indexOf(b, ai + 1);
+ var i = ai;
+ if (ai >= 0 && bi > 0) {
+ if (a === b) {
+ return [ai, bi];
+ }
+ begs = [];
+ left = str.length;
+ while (i >= 0 && !result) {
+ if (i == ai) {
+ begs.push(i);
+ ai = str.indexOf(a, i + 1);
+ } else if (begs.length == 1) {
+ result = [begs.pop(), bi];
+ } else {
+ beg = begs.pop();
+ if (beg < left) {
+ left = beg;
+ right = bi;
+ }
+ bi = str.indexOf(b, i + 1);
+ }
+ i = ai < bi && ai >= 0 ? ai : bi;
+ }
+ if (begs.length) {
+ result = [left, right];
+ }
+ }
+ return result;
+ }
+ }
+});
+
+// node_modules/@actions/glob/node_modules/brace-expansion/index.js
+var require_brace_expansion = __commonJS({
+ "node_modules/@actions/glob/node_modules/brace-expansion/index.js"(exports2, module2) {
+ "use strict";
+ var concatMap = require_concat_map();
+ var balanced = require_balanced_match();
+ module2.exports = expandTop;
+ var escSlash = "\0SLASH" + Math.random() + "\0";
+ var escOpen = "\0OPEN" + Math.random() + "\0";
+ var escClose = "\0CLOSE" + Math.random() + "\0";
+ var escComma = "\0COMMA" + Math.random() + "\0";
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
+ function numeric(str) {
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
+ }
+ function escapeBraces(str) {
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
+ }
+ function unescapeBraces(str) {
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
+ }
+ function parseCommaParts(str) {
+ if (!str)
+ return [""];
+ var parts = [];
+ var m = balanced("{", "}", str);
+ if (!m)
+ return str.split(",");
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(",");
+ p[p.length - 1] += "{" + body + "}";
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length - 1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
+ parts.push.apply(parts, p);
+ return parts;
+ }
+ function expandTop(str) {
+ if (!str)
+ return [];
+ if (str.substr(0, 2) === "{}") {
+ str = "\\{\\}" + str.substr(2);
+ }
+ return expand2(escapeBraces(str), true).map(unescapeBraces);
+ }
+ function embrace(str) {
+ return "{" + str + "}";
+ }
+ function isPadded(el) {
+ return /^-?0\d/.test(el);
+ }
+ function lte(i, y) {
+ return i <= y;
+ }
+ function gte(i, y) {
+ return i >= y;
+ }
+ function expand2(str, isTop) {
+ var expansions = [];
+ var m = balanced("{", "}", str);
+ if (!m || /\$$/.test(m.pre)) return [str];
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(",") >= 0;
+ if (!isSequence && !isOptions) {
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + "{" + m.body + escClose + m.post;
+ return expand2(str);
+ }
+ return [str];
+ }
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ n = expand2(n[0], false).map(embrace);
+ if (n.length === 1) {
+ var post = m.post.length ? expand2(m.post, false) : [""];
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
+ var pre = m.pre;
+ var post = m.post.length ? expand2(m.post, false) : [""];
+ var N;
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length);
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
+ N = [];
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === "\\")
+ c = "";
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join("0");
+ if (i < 0)
+ c = "-" + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = concatMap(n, function(el) {
+ return expand2(el, false);
+ });
+ }
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
+ }
+ return expansions;
+ }
+ }
+});
+
+// node_modules/@actions/glob/node_modules/minimatch/minimatch.js
+var require_minimatch = __commonJS({
+ "node_modules/@actions/glob/node_modules/minimatch/minimatch.js"(exports2, module2) {
+ "use strict";
+ module2.exports = minimatch;
+ minimatch.Minimatch = Minimatch;
+ var path = function() {
+ try {
+ return require("path");
+ } catch (e) {
+ }
+ }() || {
+ sep: "/"
+ };
+ minimatch.sep = path.sep;
+ var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
+ var expand2 = require_brace_expansion();
+ var plTypes = {
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
+ "?": { open: "(?:", close: ")?" },
+ "+": { open: "(?:", close: ")+" },
+ "*": { open: "(?:", close: ")*" },
+ "@": { open: "(?:", close: ")" }
+ };
+ var qmark = "[^/]";
+ var star = qmark + "*?";
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
+ var reSpecials = charSet("().*{}+?[]^$\\!");
+ function charSet(s) {
+ return s.split("").reduce(function(set, c) {
+ set[c] = true;
+ return set;
+ }, {});
+ }
+ var slashSplit = /\/+/;
+ minimatch.filter = filter;
+ function filter(pattern, options) {
+ options = options || {};
+ return function(p, i, list) {
+ return minimatch(p, pattern, options);
+ };
+ }
+ function ext(a, b) {
+ b = b || {};
+ var t = {};
+ Object.keys(a).forEach(function(k) {
+ t[k] = a[k];
+ });
+ Object.keys(b).forEach(function(k) {
+ t[k] = b[k];
+ });
+ return t;
+ }
+ minimatch.defaults = function(def) {
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
+ return minimatch;
+ }
+ var orig = minimatch;
+ var m = function minimatch2(p, pattern, options) {
+ return orig(p, pattern, ext(def, options));
+ };
+ m.Minimatch = function Minimatch2(pattern, options) {
+ return new orig.Minimatch(pattern, ext(def, options));
+ };
+ m.Minimatch.defaults = function defaults(options) {
+ return orig.defaults(ext(def, options)).Minimatch;
+ };
+ m.filter = function filter2(pattern, options) {
+ return orig.filter(pattern, ext(def, options));
+ };
+ m.defaults = function defaults(options) {
+ return orig.defaults(ext(def, options));
+ };
+ m.makeRe = function makeRe2(pattern, options) {
+ return orig.makeRe(pattern, ext(def, options));
+ };
+ m.braceExpand = function braceExpand2(pattern, options) {
+ return orig.braceExpand(pattern, ext(def, options));
+ };
+ m.match = function(list, pattern, options) {
+ return orig.match(list, pattern, ext(def, options));
+ };
+ return m;
+ };
+ Minimatch.defaults = function(def) {
+ return minimatch.defaults(def).Minimatch;
+ };
+ function minimatch(p, pattern, options) {
+ assertValidPattern(pattern);
+ if (!options) options = {};
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ return false;
+ }
+ return new Minimatch(pattern, options).match(p);
+ }
+ function Minimatch(pattern, options) {
+ if (!(this instanceof Minimatch)) {
+ return new Minimatch(pattern, options);
+ }
+ assertValidPattern(pattern);
+ if (!options) options = {};
+ pattern = pattern.trim();
+ if (!options.allowWindowsEscape && path.sep !== "/") {
+ pattern = pattern.split(path.sep).join("/");
+ }
+ this.options = options;
+ this.set = [];
+ this.pattern = pattern;
+ this.regexp = null;
+ this.negate = false;
+ this.comment = false;
+ this.empty = false;
+ this.partial = !!options.partial;
+ this.make();
+ }
+ Minimatch.prototype.debug = function() {
+ };
+ Minimatch.prototype.make = make;
+ function make() {
+ var pattern = this.pattern;
+ var options = this.options;
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ this.comment = true;
+ return;
+ }
+ if (!pattern) {
+ this.empty = true;
+ return;
+ }
+ this.parseNegate();
+ var set = this.globSet = this.braceExpand();
+ if (options.debug) this.debug = function debug2() {
+ console.error.apply(console, arguments);
+ };
+ this.debug(this.pattern, set);
+ set = this.globParts = set.map(function(s) {
+ return s.split(slashSplit);
+ });
+ this.debug(this.pattern, set);
+ set = set.map(function(s, si, set2) {
+ return s.map(this.parse, this);
+ }, this);
+ this.debug(this.pattern, set);
+ set = set.filter(function(s) {
+ return s.indexOf(false) === -1;
+ });
+ this.debug(this.pattern, set);
+ this.set = set;
+ }
+ Minimatch.prototype.parseNegate = parseNegate;
+ function parseNegate() {
+ var pattern = this.pattern;
+ var negate = false;
+ var options = this.options;
+ var negateOffset = 0;
+ if (options.nonegate) return;
+ for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
+ negate = !negate;
+ negateOffset++;
+ }
+ if (negateOffset) this.pattern = pattern.substr(negateOffset);
+ this.negate = negate;
+ }
+ minimatch.braceExpand = function(pattern, options) {
+ return braceExpand(pattern, options);
+ };
+ Minimatch.prototype.braceExpand = braceExpand;
+ function braceExpand(pattern, options) {
+ if (!options) {
+ if (this instanceof Minimatch) {
+ options = this.options;
+ } else {
+ options = {};
+ }
+ }
+ pattern = typeof pattern === "undefined" ? this.pattern : pattern;
+ assertValidPattern(pattern);
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
+ return [pattern];
+ }
+ return expand2(pattern);
+ }
+ var MAX_PATTERN_LENGTH = 1024 * 64;
+ var assertValidPattern = function(pattern) {
+ if (typeof pattern !== "string") {
+ throw new TypeError("invalid pattern");
+ }
+ if (pattern.length > MAX_PATTERN_LENGTH) {
+ throw new TypeError("pattern is too long");
+ }
+ };
+ Minimatch.prototype.parse = parse2;
+ var SUBPARSE = {};
+ function parse2(pattern, isSub) {
+ assertValidPattern(pattern);
+ var options = this.options;
+ if (pattern === "**") {
+ if (!options.noglobstar)
+ return GLOBSTAR;
+ else
+ pattern = "*";
+ }
+ if (pattern === "") return "";
+ var re = "";
+ var hasMagic = !!options.nocase;
+ var escaping = false;
+ var patternListStack = [];
+ var negativeLists = [];
+ var stateChar;
+ var inClass = false;
+ var reClassStart = -1;
+ var classStart = -1;
+ var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
+ var self = this;
+ function clearStateChar() {
+ if (stateChar) {
+ switch (stateChar) {
+ case "*":
+ re += star;
+ hasMagic = true;
+ break;
+ case "?":
+ re += qmark;
+ hasMagic = true;
+ break;
+ default:
+ re += "\\" + stateChar;
+ break;
+ }
+ self.debug("clearStateChar %j %j", stateChar, re);
+ stateChar = false;
+ }
+ }
+ for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
+ this.debug("%s %s %s %j", pattern, i, re, c);
+ if (escaping && reSpecials[c]) {
+ re += "\\" + c;
+ escaping = false;
+ continue;
+ }
+ switch (c) {
+ /* istanbul ignore next */
+ case "/": {
+ return false;
+ }
+ case "\\":
+ clearStateChar();
+ escaping = true;
+ continue;
+ // the various stateChar values
+ // for the "extglob" stuff.
+ case "?":
+ case "*":
+ case "+":
+ case "@":
+ case "!":
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
+ if (inClass) {
+ this.debug(" in class");
+ if (c === "!" && i === classStart + 1) c = "^";
+ re += c;
+ continue;
+ }
+ self.debug("call clearStateChar %j", stateChar);
+ clearStateChar();
+ stateChar = c;
+ if (options.noext) clearStateChar();
+ continue;
+ case "(":
+ if (inClass) {
+ re += "(";
+ continue;
+ }
+ if (!stateChar) {
+ re += "\\(";
+ continue;
+ }
+ patternListStack.push({
+ type: stateChar,
+ start: i - 1,
+ reStart: re.length,
+ open: plTypes[stateChar].open,
+ close: plTypes[stateChar].close
+ });
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
+ this.debug("plType %j %j", stateChar, re);
+ stateChar = false;
+ continue;
+ case ")":
+ if (inClass || !patternListStack.length) {
+ re += "\\)";
+ continue;
+ }
+ clearStateChar();
+ hasMagic = true;
+ var pl = patternListStack.pop();
+ re += pl.close;
+ if (pl.type === "!") {
+ negativeLists.push(pl);
+ }
+ pl.reEnd = re.length;
+ continue;
+ case "|":
+ if (inClass || !patternListStack.length || escaping) {
+ re += "\\|";
+ escaping = false;
+ continue;
+ }
+ clearStateChar();
+ re += "|";
+ continue;
+ // these are mostly the same in regexp and glob
+ case "[":
+ clearStateChar();
+ if (inClass) {
+ re += "\\" + c;
+ continue;
+ }
+ inClass = true;
+ classStart = i;
+ reClassStart = re.length;
+ re += c;
+ continue;
+ case "]":
+ if (i === classStart + 1 || !inClass) {
+ re += "\\" + c;
+ escaping = false;
+ continue;
+ }
+ var cs = pattern.substring(classStart + 1, i);
+ try {
+ RegExp("[" + cs + "]");
+ } catch (er) {
+ var sp = this.parse(cs, SUBPARSE);
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
+ hasMagic = hasMagic || sp[1];
+ inClass = false;
+ continue;
+ }
+ hasMagic = true;
+ inClass = false;
+ re += c;
+ continue;
+ default:
+ clearStateChar();
+ if (escaping) {
+ escaping = false;
+ } else if (reSpecials[c] && !(c === "^" && inClass)) {
+ re += "\\";
+ }
+ re += c;
+ }
+ }
+ if (inClass) {
+ cs = pattern.substr(classStart + 1);
+ sp = this.parse(cs, SUBPARSE);
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
+ hasMagic = hasMagic || sp[1];
+ }
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
+ var tail = re.slice(pl.reStart + pl.open.length);
+ this.debug("setting tail", re, pl);
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
+ if (!$2) {
+ $2 = "\\";
+ }
+ return $1 + $1 + $2 + "|";
+ });
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
+ var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
+ hasMagic = true;
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
+ }
+ clearStateChar();
+ if (escaping) {
+ re += "\\\\";
+ }
+ var addPatternStart = false;
+ switch (re.charAt(0)) {
+ case "[":
+ case ".":
+ case "(":
+ addPatternStart = true;
+ }
+ for (var n = negativeLists.length - 1; n > -1; n--) {
+ var nl = negativeLists[n];
+ var nlBefore = re.slice(0, nl.reStart);
+ var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
+ var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
+ var nlAfter = re.slice(nl.reEnd);
+ nlLast += nlAfter;
+ var openParensBefore = nlBefore.split("(").length - 1;
+ var cleanAfter = nlAfter;
+ for (i = 0; i < openParensBefore; i++) {
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
+ }
+ nlAfter = cleanAfter;
+ var dollar = "";
+ if (nlAfter === "" && isSub !== SUBPARSE) {
+ dollar = "$";
+ }
+ var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
+ re = newRe;
+ }
+ if (re !== "" && hasMagic) {
+ re = "(?=.)" + re;
+ }
+ if (addPatternStart) {
+ re = patternStart + re;
+ }
+ if (isSub === SUBPARSE) {
+ return [re, hasMagic];
+ }
+ if (!hasMagic) {
+ return globUnescape(pattern);
+ }
+ var flags = options.nocase ? "i" : "";
+ try {
+ var regExp = new RegExp("^" + re + "$", flags);
+ } catch (er) {
+ return new RegExp("$.");
+ }
+ regExp._glob = pattern;
+ regExp._src = re;
+ return regExp;
+ }
+ minimatch.makeRe = function(pattern, options) {
+ return new Minimatch(pattern, options || {}).makeRe();
+ };
+ Minimatch.prototype.makeRe = makeRe;
+ function makeRe() {
+ if (this.regexp || this.regexp === false) return this.regexp;
+ var set = this.set;
+ if (!set.length) {
+ this.regexp = false;
+ return this.regexp;
+ }
+ var options = this.options;
+ var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
+ var flags = options.nocase ? "i" : "";
+ var re = set.map(function(pattern) {
+ return pattern.map(function(p) {
+ return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
+ }).join("\\/");
+ }).join("|");
+ re = "^(?:" + re + ")$";
+ if (this.negate) re = "^(?!" + re + ").*$";
+ try {
+ this.regexp = new RegExp(re, flags);
+ } catch (ex) {
+ this.regexp = false;
+ }
+ return this.regexp;
+ }
+ minimatch.match = function(list, pattern, options) {
+ options = options || {};
+ var mm = new Minimatch(pattern, options);
+ list = list.filter(function(f) {
+ return mm.match(f);
+ });
+ if (mm.options.nonull && !list.length) {
+ list.push(pattern);
+ }
+ return list;
+ };
+ Minimatch.prototype.match = function match(f, partial) {
+ if (typeof partial === "undefined") partial = this.partial;
+ this.debug("match", f, this.pattern);
+ if (this.comment) return false;
+ if (this.empty) return f === "";
+ if (f === "/" && partial) return true;
+ var options = this.options;
+ if (path.sep !== "/") {
+ f = f.split(path.sep).join("/");
+ }
+ f = f.split(slashSplit);
+ this.debug(this.pattern, "split", f);
+ var set = this.set;
+ this.debug(this.pattern, "set", set);
+ var filename;
+ var i;
+ for (i = f.length - 1; i >= 0; i--) {
+ filename = f[i];
+ if (filename) break;
+ }
+ for (i = 0; i < set.length; i++) {
+ var pattern = set[i];
+ var file = f;
+ if (options.matchBase && pattern.length === 1) {
+ file = [filename];
+ }
+ var hit = this.matchOne(file, pattern, partial);
+ if (hit) {
+ if (options.flipNegate) return true;
+ return !this.negate;
+ }
+ }
+ if (options.flipNegate) return false;
+ return this.negate;
+ };
+ Minimatch.prototype.matchOne = function(file, pattern, partial) {
+ var options = this.options;
+ this.debug(
+ "matchOne",
+ { "this": this, file, pattern }
+ );
+ this.debug("matchOne", file.length, pattern.length);
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
+ this.debug("matchOne loop");
+ var p = pattern[pi];
+ var f = file[fi];
+ this.debug(pattern, p, f);
+ if (p === false) return false;
+ if (p === GLOBSTAR) {
+ this.debug("GLOBSTAR", [pattern, p, f]);
+ var fr = fi;
+ var pr = pi + 1;
+ if (pr === pl) {
+ this.debug("** at the end");
+ for (; fi < fl; fi++) {
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
+ }
+ return true;
+ }
+ while (fr < fl) {
+ var swallowee = file[fr];
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
+ this.debug("globstar found match!", fr, fl, swallowee);
+ return true;
+ } else {
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
+ this.debug("dot detected!", file, fr, pattern, pr);
+ break;
+ }
+ this.debug("globstar swallow a segment, and continue");
+ fr++;
+ }
+ }
+ if (partial) {
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
+ if (fr === fl) return true;
+ }
+ return false;
+ }
+ var hit;
+ if (typeof p === "string") {
+ hit = f === p;
+ this.debug("string match", p, f, hit);
+ } else {
+ hit = f.match(p);
+ this.debug("pattern match", p, f, hit);
+ }
+ if (!hit) return false;
+ }
+ if (fi === fl && pi === pl) {
+ return true;
+ } else if (fi === fl) {
+ return partial;
+ } else if (pi === pl) {
+ return fi === fl - 1 && file[fi] === "";
+ }
+ throw new Error("wtf?");
+ };
+ function globUnescape(s) {
+ return s.replace(/\\(.)/g, "$1");
+ }
+ function regExpEscape(s) {
+ return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+ }
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-path.js
+var require_internal_path = __commonJS({
+ "node_modules/@actions/glob/lib/internal-path.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.Path = void 0;
+ var path = __importStar(require("path"));
+ var pathHelper = __importStar(require_internal_path_helper());
+ var assert_1 = __importDefault(require("assert"));
+ var IS_WINDOWS = process.platform === "win32";
+ var Path = class {
+ /**
+ * Constructs a Path
+ * @param itemPath Path or array of segments
+ */
+ constructor(itemPath) {
+ this.segments = [];
+ if (typeof itemPath === "string") {
+ (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ if (!pathHelper.hasRoot(itemPath)) {
+ this.segments = itemPath.split(path.sep);
+ } else {
+ let remaining = itemPath;
+ let dir = pathHelper.dirname(remaining);
+ while (dir !== remaining) {
+ const basename = path.basename(remaining);
+ this.segments.unshift(basename);
+ remaining = dir;
+ dir = pathHelper.dirname(remaining);
+ }
+ this.segments.unshift(remaining);
+ }
+ } else {
+ (0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
+ for (let i = 0; i < itemPath.length; i++) {
+ let segment = itemPath[i];
+ (0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`);
+ segment = pathHelper.normalizeSeparators(itemPath[i]);
+ if (i === 0 && pathHelper.hasRoot(segment)) {
+ segment = pathHelper.safeTrimTrailingSeparator(segment);
+ (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
+ this.segments.push(segment);
+ } else {
+ (0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
+ this.segments.push(segment);
+ }
+ }
+ }
+ }
+ /**
+ * Converts the path to it's string representation
+ */
+ toString() {
+ let result = this.segments[0];
+ let skipSlash = result.endsWith(path.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result);
+ for (let i = 1; i < this.segments.length; i++) {
+ if (skipSlash) {
+ skipSlash = false;
+ } else {
+ result += path.sep;
+ }
+ result += this.segments[i];
+ }
+ return result;
+ }
+ };
+ exports2.Path = Path;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-pattern.js
+var require_internal_pattern = __commonJS({
+ "node_modules/@actions/glob/lib/internal-pattern.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.Pattern = void 0;
+ var os = __importStar(require("os"));
+ var path = __importStar(require("path"));
+ var pathHelper = __importStar(require_internal_path_helper());
+ var assert_1 = __importDefault(require("assert"));
+ var minimatch_1 = require_minimatch();
+ var internal_match_kind_1 = require_internal_match_kind();
+ var internal_path_1 = require_internal_path();
+ var IS_WINDOWS = process.platform === "win32";
+ var Pattern = class _Pattern {
+ constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) {
+ this.negate = false;
+ let pattern;
+ if (typeof patternOrNegate === "string") {
+ pattern = patternOrNegate.trim();
+ } else {
+ segments = segments || [];
+ (0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
+ const root = _Pattern.getLiteral(segments[0]);
+ (0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
+ pattern = new internal_path_1.Path(segments).toString().trim();
+ if (patternOrNegate) {
+ pattern = `!${pattern}`;
+ }
+ }
+ while (pattern.startsWith("!")) {
+ this.negate = !this.negate;
+ pattern = pattern.substr(1).trim();
+ }
+ pattern = _Pattern.fixupPattern(pattern, homedir);
+ this.segments = new internal_path_1.Path(pattern).segments;
+ this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path.sep);
+ pattern = pathHelper.safeTrimTrailingSeparator(pattern);
+ let foundGlob = false;
+ const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === ""));
+ this.searchPath = new internal_path_1.Path(searchSegments).toString();
+ this.rootRegExp = new RegExp(_Pattern.regExpEscape(searchSegments[0]), IS_WINDOWS ? "i" : "");
+ this.isImplicitPattern = isImplicitPattern;
+ const minimatchOptions = {
+ dot: true,
+ nobrace: true,
+ nocase: IS_WINDOWS,
+ nocomment: true,
+ noext: true,
+ nonegate: true
+ };
+ pattern = IS_WINDOWS ? pattern.replace(/\\/g, "/") : pattern;
+ this.minimatch = new minimatch_1.Minimatch(pattern, minimatchOptions);
+ }
+ /**
+ * Matches the pattern against the specified path
+ */
+ match(itemPath) {
+ if (this.segments[this.segments.length - 1] === "**") {
+ itemPath = pathHelper.normalizeSeparators(itemPath);
+ if (!itemPath.endsWith(path.sep) && this.isImplicitPattern === false) {
+ itemPath = `${itemPath}${path.sep}`;
+ }
+ } else {
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ }
+ if (this.minimatch.match(itemPath)) {
+ return this.trailingSeparator ? internal_match_kind_1.MatchKind.Directory : internal_match_kind_1.MatchKind.All;
+ }
+ return internal_match_kind_1.MatchKind.None;
+ }
+ /**
+ * Indicates whether the pattern may match descendants of the specified path
+ */
+ partialMatch(itemPath) {
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ if (pathHelper.dirname(itemPath) === itemPath) {
+ return this.rootRegExp.test(itemPath);
+ }
+ return this.minimatch.matchOne(itemPath.split(IS_WINDOWS ? /\\+/ : /\/+/), this.minimatch.set[0], true);
+ }
+ /**
+ * Escapes glob patterns within a path
+ */
+ static globEscape(s) {
+ return (IS_WINDOWS ? s : s.replace(/\\/g, "\\\\")).replace(/(\[)(?=[^/]+\])/g, "[[]").replace(/\?/g, "[?]").replace(/\*/g, "[*]");
+ }
+ /**
+ * Normalizes slashes and ensures absolute root
+ */
+ static fixupPattern(pattern, homedir) {
+ (0, assert_1.default)(pattern, "pattern cannot be empty");
+ const literalSegments = new internal_path_1.Path(pattern).segments.map((x) => _Pattern.getLiteral(x));
+ (0, assert_1.default)(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
+ (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
+ pattern = pathHelper.normalizeSeparators(pattern);
+ if (pattern === "." || pattern.startsWith(`.${path.sep}`)) {
+ pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1);
+ } else if (pattern === "~" || pattern.startsWith(`~${path.sep}`)) {
+ homedir = homedir || os.homedir();
+ (0, assert_1.default)(homedir, "Unable to determine HOME directory");
+ (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
+ pattern = _Pattern.globEscape(homedir) + pattern.substr(1);
+ } else if (IS_WINDOWS && (pattern.match(/^[A-Z]:$/i) || pattern.match(/^[A-Z]:[^\\]/i))) {
+ let root = pathHelper.ensureAbsoluteRoot("C:\\dummy-root", pattern.substr(0, 2));
+ if (pattern.length > 2 && !root.endsWith("\\")) {
+ root += "\\";
+ }
+ pattern = _Pattern.globEscape(root) + pattern.substr(2);
+ } else if (IS_WINDOWS && (pattern === "\\" || pattern.match(/^\\[^\\]/))) {
+ let root = pathHelper.ensureAbsoluteRoot("C:\\dummy-root", "\\");
+ if (!root.endsWith("\\")) {
+ root += "\\";
+ }
+ pattern = _Pattern.globEscape(root) + pattern.substr(1);
+ } else {
+ pattern = pathHelper.ensureAbsoluteRoot(_Pattern.globEscape(process.cwd()), pattern);
+ }
+ return pathHelper.normalizeSeparators(pattern);
+ }
+ /**
+ * Attempts to unescape a pattern segment to create a literal path segment.
+ * Otherwise returns empty string.
+ */
+ static getLiteral(segment) {
+ let literal = "";
+ for (let i = 0; i < segment.length; i++) {
+ const c = segment[i];
+ if (c === "\\" && !IS_WINDOWS && i + 1 < segment.length) {
+ literal += segment[++i];
+ continue;
+ } else if (c === "*" || c === "?") {
+ return "";
+ } else if (c === "[" && i + 1 < segment.length) {
+ let set = "";
+ let closed = -1;
+ for (let i2 = i + 1; i2 < segment.length; i2++) {
+ const c2 = segment[i2];
+ if (c2 === "\\" && !IS_WINDOWS && i2 + 1 < segment.length) {
+ set += segment[++i2];
+ continue;
+ } else if (c2 === "]") {
+ closed = i2;
+ break;
+ } else {
+ set += c2;
+ }
+ }
+ if (closed >= 0) {
+ if (set.length > 1) {
+ return "";
+ }
+ if (set) {
+ literal += set;
+ i = closed;
+ continue;
+ }
+ }
+ }
+ literal += c;
+ }
+ return literal;
+ }
+ /**
+ * Escapes regexp special characters
+ * https://javascript.info/regexp-escaping
+ */
+ static regExpEscape(s) {
+ return s.replace(/[[\\^$.|?*+()]/g, "\\$&");
+ }
+ };
+ exports2.Pattern = Pattern;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-search-state.js
+var require_internal_search_state = __commonJS({
+ "node_modules/@actions/glob/lib/internal-search-state.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.SearchState = void 0;
+ var SearchState = class {
+ constructor(path, level) {
+ this.path = path;
+ this.level = level;
+ }
+ };
+ exports2.SearchState = SearchState;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-globber.js
+var require_internal_globber = __commonJS({
+ "node_modules/@actions/glob/lib/internal-globber.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __awaiter = exports2 && exports2.__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());
+ });
+ };
+ var __asyncValues = exports2 && exports2.__asyncValues || function(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i);
+ function verb(n) {
+ i[n] = o[n] && function(v) {
+ return new Promise(function(resolve, reject) {
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
+ });
+ };
+ }
+ function settle(resolve, reject, d, v) {
+ Promise.resolve(v).then(function(v2) {
+ resolve({ value: v2, done: d });
+ }, reject);
+ }
+ };
+ var __await = exports2 && exports2.__await || function(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+ };
+ var __asyncGenerator = exports2 && exports2.__asyncGenerator || function(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i;
+ function verb(n) {
+ if (g[n]) i[n] = function(v) {
+ return new Promise(function(a, b) {
+ q.push([n, v, a, b]) > 1 || resume(n, v);
+ });
+ };
+ }
+ function resume(n, v) {
+ try {
+ step(g[n](v));
+ } catch (e) {
+ settle(q[0][3], e);
+ }
+ }
+ function step(r) {
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
+ }
+ function fulfill(value) {
+ resume("next", value);
+ }
+ function reject(value) {
+ resume("throw", value);
+ }
+ function settle(f, v) {
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
+ }
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.DefaultGlobber = void 0;
+ var core = __importStar(require_core());
+ var fs = __importStar(require("fs"));
+ var globOptionsHelper = __importStar(require_internal_glob_options_helper());
+ var path = __importStar(require("path"));
+ var patternHelper = __importStar(require_internal_pattern_helper());
+ var internal_match_kind_1 = require_internal_match_kind();
+ var internal_pattern_1 = require_internal_pattern();
+ var internal_search_state_1 = require_internal_search_state();
+ var IS_WINDOWS = process.platform === "win32";
+ var DefaultGlobber = class _DefaultGlobber {
+ constructor(options) {
+ this.patterns = [];
+ this.searchPaths = [];
+ this.options = globOptionsHelper.getOptions(options);
+ }
+ getSearchPaths() {
+ return this.searchPaths.slice();
+ }
+ glob() {
+ var _a2, e_1, _b, _c;
+ return __awaiter(this, void 0, void 0, function* () {
+ const result = [];
+ try {
+ for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a2 = _f.done, !_a2; _d = true) {
+ _c = _f.value;
+ _d = false;
+ const itemPath = _c;
+ result.push(itemPath);
+ }
+ } catch (e_1_1) {
+ e_1 = { error: e_1_1 };
+ } finally {
+ try {
+ if (!_d && !_a2 && (_b = _e.return)) yield _b.call(_e);
+ } finally {
+ if (e_1) throw e_1.error;
+ }
+ }
+ return result;
+ });
+ }
+ globGenerator() {
+ return __asyncGenerator(this, arguments, function* globGenerator_1() {
+ const options = globOptionsHelper.getOptions(this.options);
+ const patterns = [];
+ for (const pattern of this.patterns) {
+ patterns.push(pattern);
+ if (options.implicitDescendants && (pattern.trailingSeparator || pattern.segments[pattern.segments.length - 1] !== "**")) {
+ patterns.push(new internal_pattern_1.Pattern(pattern.negate, true, pattern.segments.concat("**")));
+ }
+ }
+ const stack = [];
+ for (const searchPath of patternHelper.getSearchPaths(patterns)) {
+ core.debug(`Search path '${searchPath}'`);
+ try {
+ yield __await(fs.promises.lstat(searchPath));
+ } catch (err) {
+ if (err.code === "ENOENT") {
+ continue;
+ }
+ throw err;
+ }
+ stack.unshift(new internal_search_state_1.SearchState(searchPath, 1));
+ }
+ const traversalChain = [];
+ while (stack.length) {
+ const item = stack.pop();
+ const match = patternHelper.match(patterns, item.path);
+ const partialMatch = !!match || patternHelper.partialMatch(patterns, item.path);
+ if (!match && !partialMatch) {
+ continue;
+ }
+ const stats = yield __await(
+ _DefaultGlobber.stat(item, options, traversalChain)
+ // Broken symlink, or symlink cycle detected, or no longer exists
+ );
+ if (!stats) {
+ continue;
+ }
+ if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
+ continue;
+ }
+ if (stats.isDirectory()) {
+ if (match & internal_match_kind_1.MatchKind.Directory && options.matchDirectories) {
+ yield yield __await(item.path);
+ } else if (!partialMatch) {
+ continue;
+ }
+ const childLevel = item.level + 1;
+ const childItems = (yield __await(fs.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path.join(item.path, x), childLevel));
+ stack.push(...childItems.reverse());
+ } else if (match & internal_match_kind_1.MatchKind.File) {
+ yield yield __await(item.path);
+ }
+ }
+ });
+ }
+ /**
+ * Constructs a DefaultGlobber
+ */
+ static create(patterns, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const result = new _DefaultGlobber(options);
+ if (IS_WINDOWS) {
+ patterns = patterns.replace(/\r\n/g, "\n");
+ patterns = patterns.replace(/\r/g, "\n");
+ }
+ const lines = patterns.split("\n").map((x) => x.trim());
+ for (const line of lines) {
+ if (!line || line.startsWith("#")) {
+ continue;
+ } else {
+ result.patterns.push(new internal_pattern_1.Pattern(line));
+ }
+ }
+ result.searchPaths.push(...patternHelper.getSearchPaths(result.patterns));
+ return result;
+ });
+ }
+ static stat(item, options, traversalChain) {
+ return __awaiter(this, void 0, void 0, function* () {
+ let stats;
+ if (options.followSymbolicLinks) {
+ try {
+ stats = yield fs.promises.stat(item.path);
+ } catch (err) {
+ if (err.code === "ENOENT") {
+ if (options.omitBrokenSymbolicLinks) {
+ core.debug(`Broken symlink '${item.path}'`);
+ return void 0;
+ }
+ throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`);
+ }
+ throw err;
+ }
+ } else {
+ stats = yield fs.promises.lstat(item.path);
+ }
+ if (stats.isDirectory() && options.followSymbolicLinks) {
+ const realPath = yield fs.promises.realpath(item.path);
+ while (traversalChain.length >= item.level) {
+ traversalChain.pop();
+ }
+ if (traversalChain.some((x) => x === realPath)) {
+ core.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`);
+ return void 0;
+ }
+ traversalChain.push(realPath);
+ }
+ return stats;
+ });
+ }
+ };
+ exports2.DefaultGlobber = DefaultGlobber;
+ }
+});
-`;
- content += `- size: ${formatValue(contractBefore?.deployment.size, item.deployment.size)} / 49152
+// node_modules/@actions/glob/lib/internal-hash-files.js
+var require_internal_hash_files = __commonJS({
+ "node_modules/@actions/glob/lib/internal-hash-files.js"(exports2) {
+ "use strict";
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports2 && exports2.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __awaiter = exports2 && exports2.__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());
+ });
+ };
+ var __asyncValues = exports2 && exports2.__asyncValues || function(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i);
+ function verb(n) {
+ i[n] = o[n] && function(v) {
+ return new Promise(function(resolve, reject) {
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
+ });
+ };
+ }
+ function settle(resolve, reject, d, v) {
+ Promise.resolve(v).then(function(v2) {
+ resolve({ value: v2, done: d });
+ }, reject);
+ }
+ };
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.hashFiles = void 0;
+ var crypto = __importStar(require("crypto"));
+ var core = __importStar(require_core());
+ var fs = __importStar(require("fs"));
+ var stream = __importStar(require("stream"));
+ var util = __importStar(require("util"));
+ var path = __importStar(require("path"));
+ function hashFiles(globber, currentWorkspace, verbose = false) {
+ var _a2, e_1, _b, _c;
+ var _d;
+ return __awaiter(this, void 0, void 0, function* () {
+ const writeDelegate = verbose ? core.info : core.debug;
+ let hasMatch = false;
+ const githubWorkspace = currentWorkspace ? currentWorkspace : (_d = process.env["GITHUB_WORKSPACE"]) !== null && _d !== void 0 ? _d : process.cwd();
+ const result = crypto.createHash("sha256");
+ let count = 0;
+ try {
+ for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a2 = _g.done, !_a2; _e = true) {
+ _c = _g.value;
+ _e = false;
+ const file = _c;
+ writeDelegate(file);
+ if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
+ writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
+ continue;
+ }
+ if (fs.statSync(file).isDirectory()) {
+ writeDelegate(`Skip directory '${file}'.`);
+ continue;
+ }
+ const hash = crypto.createHash("sha256");
+ const pipeline = util.promisify(stream.pipeline);
+ yield pipeline(fs.createReadStream(file), hash);
+ result.write(hash.digest());
+ count++;
+ if (!hasMatch) {
+ hasMatch = true;
+ }
+ }
+ } catch (e_1_1) {
+ e_1 = { error: e_1_1 };
+ } finally {
+ try {
+ if (!_e && !_a2 && (_b = _f.return)) yield _b.call(_f);
+ } finally {
+ if (e_1) throw e_1.error;
+ }
+ }
+ result.end();
+ if (hasMatch) {
+ writeDelegate(`Found ${count} files to hash.`);
+ return result.digest("hex");
+ } else {
+ writeDelegate(`No matches found for glob`);
+ return "";
+ }
+ });
+ }
+ exports2.hashFiles = hashFiles;
+ }
+});
-`;
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item.functions) === JSON.stringify(contractBefore.functions))
- return;
- else {
- let rows = `| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-`;
- Object.entries(item.functions).map(([method, values]) => {
- const before2 = contractBefore && findFunction(method, contractBefore.functions);
- if (options.ignoreUnchanged && before2 && JSON.stringify(before2) === JSON.stringify(values))
- return;
- rows += `${method} | ${formatValue(before2?.min, values.min)} | ${formatValue(before2?.mean, values.mean)} | ${formatValue(before2?.median, values.median)} | ${formatValue(before2?.max, values.max)} | ${formatValue(before2?.calls, values.calls)} |
-`;
+// node_modules/@actions/glob/lib/glob.js
+var require_glob = __commonJS({
+ "node_modules/@actions/glob/lib/glob.js"(exports2) {
+ "use strict";
+ var __awaiter = exports2 && exports2.__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(exports2, "__esModule", { value: true });
+ exports2.hashFiles = exports2.create = void 0;
+ var internal_globber_1 = require_internal_globber();
+ var internal_hash_files_1 = require_internal_hash_files();
+ function create(patterns, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return yield internal_globber_1.DefaultGlobber.create(patterns, options);
});
- content += rows;
}
- content += "\n\n";
- });
- return content;
-}
+ exports2.create = create;
+ function hashFiles(patterns, currentWorkspace = "", options, verbose = false) {
+ return __awaiter(this, void 0, void 0, function* () {
+ let followSymbolicLinks = true;
+ if (options && typeof options.followSymbolicLinks === "boolean") {
+ followSymbolicLinks = options.followSymbolicLinks;
+ }
+ const globber = yield create(patterns, { followSymbolicLinks });
+ return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
+ });
+ }
+ exports2.hashFiles = hashFiles;
+ }
+});
// src/action.ts
-var root = (0, import_core.getInput)("ROOT_REPORT_PATH");
-var current = (0, import_core.getInput)("REPORT_PATH");
-var rootExists = root && (0, import_fs.existsSync)(root);
-var currentExists = current && (0, import_fs.existsSync)(current);
-if (!currentExists) throw new Error("gas report not found");
-var rootContent = rootExists ? JSON.parse((0, import_fs.readFileSync)(root, "utf8")) : [];
-var currentContent = JSON.parse((0, import_fs.readFileSync)(current, "utf8"));
-var table = getHtmlGasReport(rootContent, currentContent, {
- rootUrl: `${import_github.context.payload.repository?.html_url}/blob/${import_github.context.sha}/`,
- ignoreUnchanged: (0, import_core.getInput)("ignoreUnchanged") === "true"
-});
-(0, import_core.setOutput)(
- "report",
- `:fuelpump: Gas report
+var import_promises = require("fs/promises");
+var import_core = __toESM(require_core());
+var import_github = __toESM(require_github());
+var import_glob = __toESM(require_glob());
-${table}
+// src/lib.ts
+var numberFormat = new Intl.NumberFormat("en-US");
- `
-);
+// src/action.ts
+var baseBranch = (0, import_core.getInput)("baseBranch");
+var octokit = (0, import_github.getOctokit)((0, import_core.getInput)("token"));
+(0, import_core.debug)(`Base branch: ${baseBranch}`);
/*! Bundled license information:
undici/lib/fetch/body.js:
diff --git a/dist/action.mjs b/dist/action.mjs
index cfa1988..036c054 100644
--- a/dist/action.mjs
+++ b/dist/action.mjs
@@ -416,7 +416,7 @@ var require_tunnel = __commonJS({
connectOptions.headers = connectOptions.headers || {};
connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64");
}
- debug("making CONNECT request");
+ debug2("making CONNECT request");
var connectReq = self.request(connectOptions);
connectReq.useChunkedEncodingByDefault = false;
connectReq.once("response", onResponse);
@@ -436,7 +436,7 @@ var require_tunnel = __commonJS({
connectReq.removeAllListeners();
socket.removeAllListeners();
if (res.statusCode !== 200) {
- debug(
+ debug2(
"tunneling socket could not be established, statusCode=%d",
res.statusCode
);
@@ -448,7 +448,7 @@ var require_tunnel = __commonJS({
return;
}
if (head.length > 0) {
- debug("got illegal response body from proxy");
+ debug2("got illegal response body from proxy");
socket.destroy();
var error = new Error("got illegal response body from proxy");
error.code = "ECONNRESET";
@@ -456,13 +456,13 @@ var require_tunnel = __commonJS({
self.removeSocket(placeholder);
return;
}
- debug("tunneling connection has established");
+ debug2("tunneling connection has established");
self.sockets[self.sockets.indexOf(placeholder)] = socket;
return cb(socket);
}
function onError(cause) {
connectReq.removeAllListeners();
- debug(
+ debug2(
"tunneling socket could not be established, cause=%s\n",
cause.message,
cause.stack
@@ -524,9 +524,9 @@ var require_tunnel = __commonJS({
}
return target;
}
- var debug;
+ var debug2;
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
- debug = function() {
+ debug2 = function() {
var args = Array.prototype.slice.call(arguments);
if (typeof args[0] === "string") {
args[0] = "TUNNEL: " + args[0];
@@ -536,10 +536,10 @@ var require_tunnel = __commonJS({
console.error.apply(console, args);
};
} else {
- debug = function() {
+ debug2 = function() {
};
}
- exports.debug = debug;
+ exports.debug = debug2;
}
});
@@ -4159,7 +4159,7 @@ var require_util2 = __commonJS({
if (input.length < MAXIMUM_ARGUMENT_LENGTH) {
return String.fromCharCode(...input);
}
- return input.reduce((previous, current2) => previous + String.fromCharCode(current2), "");
+ return input.reduce((previous, current) => previous + String.fromCharCode(current), "");
}
function readableStreamClose(controller) {
try {
@@ -11234,8 +11234,8 @@ var require_RetryHandler = __commonJS({
var { RequestRetryError } = require_errors();
var { isDisturbed, parseHeaders, parseRangeHeader } = require_util();
function calculateRetryAfterHeader(retryAfter) {
- const current2 = Date.now();
- const diff = new Date(retryAfter).getTime() - current2;
+ const current = Date.now();
+ const diff = new Date(retryAfter).getTime() - current;
return diff;
}
var RetryHandler = class _RetryHandler {
@@ -19786,10 +19786,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
return process.env["RUNNER_DEBUG"] === "1";
}
exports.isDebug = isDebug;
- function debug(message) {
+ function debug2(message) {
(0, command_1.issueCommand)("debug", {}, message);
}
- exports.debug = debug;
+ exports.debug = debug2;
function error(message, properties = {}) {
(0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
}
@@ -23338,15 +23338,15 @@ var init_endpoints = __esm({
});
// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js
-function endpointsToMethods(octokit) {
+function endpointsToMethods(octokit2) {
const newMethods = {};
for (const scope of endpointMethodsMap.keys()) {
- newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
+ newMethods[scope] = new Proxy({ octokit: octokit2, scope, cache: {} }, handler);
}
return newMethods;
}
-function decorate(octokit, scope, methodName, defaults, decorations) {
- const requestWithDefaults = octokit.request.defaults(defaults);
+function decorate(octokit2, scope, methodName, defaults, decorations) {
+ const requestWithDefaults = octokit2.request.defaults(defaults);
function withDecorations(...args) {
let options = requestWithDefaults.endpoint.merge(...args);
if (decorations.mapToData) {
@@ -23358,12 +23358,12 @@ function decorate(octokit, scope, methodName, defaults, decorations) {
}
if (decorations.renamed) {
const [newScope, newMethodName] = decorations.renamed;
- octokit.log.warn(
+ octokit2.log.warn(
`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
);
}
if (decorations.deprecated) {
- octokit.log.warn(decorations.deprecated);
+ octokit2.log.warn(decorations.deprecated);
}
if (decorations.renamedParameters) {
const options2 = requestWithDefaults.endpoint.merge(...args);
@@ -23371,7 +23371,7 @@ function decorate(octokit, scope, methodName, defaults, decorations) {
decorations.renamedParameters
)) {
if (name in options2) {
- octokit.log.warn(
+ octokit2.log.warn(
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
);
if (!(alias in options2)) {
@@ -23441,7 +23441,7 @@ var init_endpoints_to_methods = __esm({
set(target, methodName, value) {
return target.cache[methodName] = value;
},
- get({ octokit, scope, cache }, methodName) {
+ get({ octokit: octokit2, scope, cache }, methodName) {
if (cache[methodName]) {
return cache[methodName];
}
@@ -23452,14 +23452,14 @@ var init_endpoints_to_methods = __esm({
const { endpointDefaults, decorations } = method;
if (decorations) {
cache[methodName] = decorate(
- octokit,
+ octokit2,
scope,
methodName,
endpointDefaults,
decorations
);
} else {
- cache[methodName] = octokit.request.defaults(endpointDefaults);
+ cache[methodName] = octokit2.request.defaults(endpointDefaults);
}
return cache[methodName];
}
@@ -23473,14 +23473,14 @@ __export(dist_src_exports, {
legacyRestEndpointMethods: () => legacyRestEndpointMethods,
restEndpointMethods: () => restEndpointMethods
});
-function restEndpointMethods(octokit) {
- const api = endpointsToMethods(octokit);
+function restEndpointMethods(octokit2) {
+ const api = endpointsToMethods(octokit2);
return {
rest: api
};
}
-function legacyRestEndpointMethods(octokit) {
- const api = endpointsToMethods(octokit);
+function legacyRestEndpointMethods(octokit2) {
+ const api = endpointsToMethods(octokit2);
return {
...api,
rest: api
@@ -23532,9 +23532,9 @@ function normalizePaginatedListResponse(response) {
response.data.total_count = totalCount;
return response;
}
-function iterator(octokit, route, parameters) {
- const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
- const requestMethod = typeof route === "function" ? route : octokit.request;
+function iterator(octokit2, route, parameters) {
+ const options = typeof route === "function" ? route.endpoint(parameters) : octokit2.request.endpoint(route, parameters);
+ const requestMethod = typeof route === "function" ? route : octokit2.request;
const method = options.method;
const headers = options.headers;
let url = options.url;
@@ -23566,19 +23566,19 @@ function iterator(octokit, route, parameters) {
})
};
}
-function paginate(octokit, route, parameters, mapFn) {
+function paginate(octokit2, route, parameters, mapFn) {
if (typeof parameters === "function") {
mapFn = parameters;
parameters = void 0;
}
return gather(
- octokit,
+ octokit2,
[],
- iterator(octokit, route, parameters)[Symbol.asyncIterator](),
+ iterator(octokit2, route, parameters)[Symbol.asyncIterator](),
mapFn
);
}
-function gather(octokit, results, iterator2, mapFn) {
+function gather(octokit2, results, iterator2, mapFn) {
return iterator2.next().then((result) => {
if (result.done) {
return results;
@@ -23593,7 +23593,7 @@ function gather(octokit, results, iterator2, mapFn) {
if (earlyExit) {
return results;
}
- return gather(octokit, results, iterator2, mapFn);
+ return gather(octokit2, results, iterator2, mapFn);
});
}
function isPaginatingEndpoint(arg) {
@@ -23603,10 +23603,10 @@ function isPaginatingEndpoint(arg) {
return false;
}
}
-function paginateRest(octokit) {
+function paginateRest(octokit2) {
return {
- paginate: Object.assign(paginate.bind(null, octokit), {
- iterator: iterator.bind(null, octokit)
+ paginate: Object.assign(paginate.bind(null, octokit2), {
+ iterator: iterator.bind(null, octokit2)
})
};
}
@@ -23954,92 +23954,1919 @@ var require_github = __commonJS({
var Context = __importStar(require_context());
var utils_1 = require_utils4();
exports.context = new Context.Context();
- function getOctokit(token, options, ...additionalPlugins) {
+ function getOctokit2(token, options, ...additionalPlugins) {
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
}
- exports.getOctokit = getOctokit;
+ exports.getOctokit = getOctokit2;
}
});
-// src/action.ts
-var import_core = __toESM(require_core());
-var import_github = __toESM(require_github());
-import { readFileSync, existsSync } from "fs";
+// node_modules/@actions/glob/lib/internal-glob-options-helper.js
+var require_internal_glob_options_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-glob-options-helper.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.getOptions = void 0;
+ var core = __importStar(require_core());
+ function getOptions(copy) {
+ const result = {
+ followSymbolicLinks: true,
+ implicitDescendants: true,
+ matchDirectories: true,
+ omitBrokenSymbolicLinks: true,
+ excludeHiddenFiles: false
+ };
+ if (copy) {
+ if (typeof copy.followSymbolicLinks === "boolean") {
+ result.followSymbolicLinks = copy.followSymbolicLinks;
+ core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`);
+ }
+ if (typeof copy.implicitDescendants === "boolean") {
+ result.implicitDescendants = copy.implicitDescendants;
+ core.debug(`implicitDescendants '${result.implicitDescendants}'`);
+ }
+ if (typeof copy.matchDirectories === "boolean") {
+ result.matchDirectories = copy.matchDirectories;
+ core.debug(`matchDirectories '${result.matchDirectories}'`);
+ }
+ if (typeof copy.omitBrokenSymbolicLinks === "boolean") {
+ result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
+ core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
+ }
+ if (typeof copy.excludeHiddenFiles === "boolean") {
+ result.excludeHiddenFiles = copy.excludeHiddenFiles;
+ core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
+ }
+ }
+ return result;
+ }
+ exports.getOptions = getOptions;
+ }
+});
-// src/lib.ts
-var UP = `\u2191`;
-var DOWN = `\u2193`;
-function findContract(contract, snapshot) {
- return snapshot.find((item) => item.contract === contract);
-}
-function findFunction(fn, snapshot) {
- return snapshot[fn];
-}
-function formatValue(before, after) {
- if (!before || after === before) return after;
- const diff = (after - before) / Math.abs(before) * 100;
- if (Math.abs(diff) < 0.1) return after;
- return `${diff > 0 ? UP : DOWN}${new Intl.NumberFormat(
- "en-US",
- {
- maximumSignificantDigits: 2
- }
- ).format(diff)}%${after}`;
-}
-function getHtmlGasReport(before, after, options = {}) {
- let content = "";
- after.map((item) => {
- const contractBefore = findContract(item.contract, before);
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item) === JSON.stringify(contractBefore))
- return;
- const [path, name] = item.contract.split(":");
- content += `### [${name}](${options.rootUrl}${path})
+// node_modules/@actions/glob/lib/internal-path-helper.js
+var require_internal_path_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-path-helper.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports && exports.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0;
+ var path = __importStar(__require("path"));
+ var assert_1 = __importDefault(__require("assert"));
+ var IS_WINDOWS = process.platform === "win32";
+ function dirname(p) {
+ p = safeTrimTrailingSeparator(p);
+ if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
+ return p;
+ }
+ let result = path.dirname(p);
+ if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
+ result = safeTrimTrailingSeparator(result);
+ }
+ return result;
+ }
+ exports.dirname = dirname;
+ function ensureAbsoluteRoot(root, itemPath) {
+ (0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
+ (0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
+ if (hasAbsoluteRoot(itemPath)) {
+ return itemPath;
+ }
+ if (IS_WINDOWS) {
+ if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
+ let cwd = process.cwd();
+ (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
+ if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
+ if (itemPath.length === 2) {
+ return `${itemPath[0]}:\\${cwd.substr(3)}`;
+ } else {
+ if (!cwd.endsWith("\\")) {
+ cwd += "\\";
+ }
+ return `${itemPath[0]}:\\${cwd.substr(3)}${itemPath.substr(2)}`;
+ }
+ } else {
+ return `${itemPath[0]}:\\${itemPath.substr(2)}`;
+ }
+ } else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
+ const cwd = process.cwd();
+ (0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
+ return `${cwd[0]}:\\${itemPath.substr(1)}`;
+ }
+ }
+ (0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
+ if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) {
+ } else {
+ root += path.sep;
+ }
+ return root + itemPath;
+ }
+ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
+ function hasAbsoluteRoot(itemPath) {
+ (0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
+ itemPath = normalizeSeparators(itemPath);
+ if (IS_WINDOWS) {
+ return itemPath.startsWith("\\\\") || /^[A-Z]:\\/i.test(itemPath);
+ }
+ return itemPath.startsWith("/");
+ }
+ exports.hasAbsoluteRoot = hasAbsoluteRoot;
+ function hasRoot(itemPath) {
+ (0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
+ itemPath = normalizeSeparators(itemPath);
+ if (IS_WINDOWS) {
+ return itemPath.startsWith("\\") || /^[A-Z]:/i.test(itemPath);
+ }
+ return itemPath.startsWith("/");
+ }
+ exports.hasRoot = hasRoot;
+ function normalizeSeparators(p) {
+ p = p || "";
+ if (IS_WINDOWS) {
+ p = p.replace(/\//g, "\\");
+ const isUnc = /^\\\\+[^\\]/.test(p);
+ return (isUnc ? "\\" : "") + p.replace(/\\\\+/g, "\\");
+ }
+ return p.replace(/\/\/+/g, "/");
+ }
+ exports.normalizeSeparators = normalizeSeparators;
+ function safeTrimTrailingSeparator(p) {
+ if (!p) {
+ return "";
+ }
+ p = normalizeSeparators(p);
+ if (!p.endsWith(path.sep)) {
+ return p;
+ }
+ if (p === path.sep) {
+ return p;
+ }
+ if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) {
+ return p;
+ }
+ return p.substr(0, p.length - 1);
+ }
+ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-match-kind.js
+var require_internal_match_kind = __commonJS({
+ "node_modules/@actions/glob/lib/internal-match-kind.js"(exports) {
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.MatchKind = void 0;
+ var MatchKind;
+ (function(MatchKind2) {
+ MatchKind2[MatchKind2["None"] = 0] = "None";
+ MatchKind2[MatchKind2["Directory"] = 1] = "Directory";
+ MatchKind2[MatchKind2["File"] = 2] = "File";
+ MatchKind2[MatchKind2["All"] = 3] = "All";
+ })(MatchKind || (exports.MatchKind = MatchKind = {}));
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-pattern-helper.js
+var require_internal_pattern_helper = __commonJS({
+ "node_modules/@actions/glob/lib/internal-pattern-helper.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.partialMatch = exports.match = exports.getSearchPaths = void 0;
+ var pathHelper = __importStar(require_internal_path_helper());
+ var internal_match_kind_1 = require_internal_match_kind();
+ var IS_WINDOWS = process.platform === "win32";
+ function getSearchPaths(patterns) {
+ patterns = patterns.filter((x) => !x.negate);
+ const searchPathMap = {};
+ for (const pattern of patterns) {
+ const key = IS_WINDOWS ? pattern.searchPath.toUpperCase() : pattern.searchPath;
+ searchPathMap[key] = "candidate";
+ }
+ const result = [];
+ for (const pattern of patterns) {
+ const key = IS_WINDOWS ? pattern.searchPath.toUpperCase() : pattern.searchPath;
+ if (searchPathMap[key] === "included") {
+ continue;
+ }
+ let foundAncestor = false;
+ let tempKey = key;
+ let parent = pathHelper.dirname(tempKey);
+ while (parent !== tempKey) {
+ if (searchPathMap[parent]) {
+ foundAncestor = true;
+ break;
+ }
+ tempKey = parent;
+ parent = pathHelper.dirname(tempKey);
+ }
+ if (!foundAncestor) {
+ result.push(pattern.searchPath);
+ searchPathMap[key] = "included";
+ }
+ }
+ return result;
+ }
+ exports.getSearchPaths = getSearchPaths;
+ function match(patterns, itemPath) {
+ let result = internal_match_kind_1.MatchKind.None;
+ for (const pattern of patterns) {
+ if (pattern.negate) {
+ result &= ~pattern.match(itemPath);
+ } else {
+ result |= pattern.match(itemPath);
+ }
+ }
+ return result;
+ }
+ exports.match = match;
+ function partialMatch(patterns, itemPath) {
+ return patterns.some((x) => !x.negate && x.partialMatch(itemPath));
+ }
+ exports.partialMatch = partialMatch;
+ }
+});
+
+// node_modules/concat-map/index.js
+var require_concat_map = __commonJS({
+ "node_modules/concat-map/index.js"(exports, module) {
+ "use strict";
+ module.exports = function(xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ var x = fn(xs[i], i);
+ if (isArray(x)) res.push.apply(res, x);
+ else res.push(x);
+ }
+ return res;
+ };
+ var isArray = Array.isArray || function(xs) {
+ return Object.prototype.toString.call(xs) === "[object Array]";
+ };
+ }
+});
+
+// node_modules/balanced-match/index.js
+var require_balanced_match = __commonJS({
+ "node_modules/balanced-match/index.js"(exports, module) {
+ "use strict";
+ module.exports = balanced;
+ function balanced(a, b, str) {
+ if (a instanceof RegExp) a = maybeMatch(a, str);
+ if (b instanceof RegExp) b = maybeMatch(b, str);
+ var r = range(a, b, str);
+ return r && {
+ start: r[0],
+ end: r[1],
+ pre: str.slice(0, r[0]),
+ body: str.slice(r[0] + a.length, r[1]),
+ post: str.slice(r[1] + b.length)
+ };
+ }
+ function maybeMatch(reg, str) {
+ var m = str.match(reg);
+ return m ? m[0] : null;
+ }
+ balanced.range = range;
+ function range(a, b, str) {
+ var begs, beg, left, right, result;
+ var ai = str.indexOf(a);
+ var bi = str.indexOf(b, ai + 1);
+ var i = ai;
+ if (ai >= 0 && bi > 0) {
+ if (a === b) {
+ return [ai, bi];
+ }
+ begs = [];
+ left = str.length;
+ while (i >= 0 && !result) {
+ if (i == ai) {
+ begs.push(i);
+ ai = str.indexOf(a, i + 1);
+ } else if (begs.length == 1) {
+ result = [begs.pop(), bi];
+ } else {
+ beg = begs.pop();
+ if (beg < left) {
+ left = beg;
+ right = bi;
+ }
+ bi = str.indexOf(b, i + 1);
+ }
+ i = ai < bi && ai >= 0 ? ai : bi;
+ }
+ if (begs.length) {
+ result = [left, right];
+ }
+ }
+ return result;
+ }
+ }
+});
+
+// node_modules/@actions/glob/node_modules/brace-expansion/index.js
+var require_brace_expansion = __commonJS({
+ "node_modules/@actions/glob/node_modules/brace-expansion/index.js"(exports, module) {
+ "use strict";
+ var concatMap = require_concat_map();
+ var balanced = require_balanced_match();
+ module.exports = expandTop;
+ var escSlash = "\0SLASH" + Math.random() + "\0";
+ var escOpen = "\0OPEN" + Math.random() + "\0";
+ var escClose = "\0CLOSE" + Math.random() + "\0";
+ var escComma = "\0COMMA" + Math.random() + "\0";
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
+ function numeric(str) {
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
+ }
+ function escapeBraces(str) {
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
+ }
+ function unescapeBraces(str) {
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
+ }
+ function parseCommaParts(str) {
+ if (!str)
+ return [""];
+ var parts = [];
+ var m = balanced("{", "}", str);
+ if (!m)
+ return str.split(",");
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(",");
+ p[p.length - 1] += "{" + body + "}";
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length - 1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
+ parts.push.apply(parts, p);
+ return parts;
+ }
+ function expandTop(str) {
+ if (!str)
+ return [];
+ if (str.substr(0, 2) === "{}") {
+ str = "\\{\\}" + str.substr(2);
+ }
+ return expand2(escapeBraces(str), true).map(unescapeBraces);
+ }
+ function embrace(str) {
+ return "{" + str + "}";
+ }
+ function isPadded(el) {
+ return /^-?0\d/.test(el);
+ }
+ function lte(i, y) {
+ return i <= y;
+ }
+ function gte(i, y) {
+ return i >= y;
+ }
+ function expand2(str, isTop) {
+ var expansions = [];
+ var m = balanced("{", "}", str);
+ if (!m || /\$$/.test(m.pre)) return [str];
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(",") >= 0;
+ if (!isSequence && !isOptions) {
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + "{" + m.body + escClose + m.post;
+ return expand2(str);
+ }
+ return [str];
+ }
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ n = expand2(n[0], false).map(embrace);
+ if (n.length === 1) {
+ var post = m.post.length ? expand2(m.post, false) : [""];
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
+ var pre = m.pre;
+ var post = m.post.length ? expand2(m.post, false) : [""];
+ var N;
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length);
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
+ N = [];
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === "\\")
+ c = "";
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join("0");
+ if (i < 0)
+ c = "-" + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = concatMap(n, function(el) {
+ return expand2(el, false);
+ });
+ }
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
+ }
+ return expansions;
+ }
+ }
+});
+
+// node_modules/@actions/glob/node_modules/minimatch/minimatch.js
+var require_minimatch = __commonJS({
+ "node_modules/@actions/glob/node_modules/minimatch/minimatch.js"(exports, module) {
+ "use strict";
+ module.exports = minimatch;
+ minimatch.Minimatch = Minimatch;
+ var path = function() {
+ try {
+ return __require("path");
+ } catch (e) {
+ }
+ }() || {
+ sep: "/"
+ };
+ minimatch.sep = path.sep;
+ var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
+ var expand2 = require_brace_expansion();
+ var plTypes = {
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
+ "?": { open: "(?:", close: ")?" },
+ "+": { open: "(?:", close: ")+" },
+ "*": { open: "(?:", close: ")*" },
+ "@": { open: "(?:", close: ")" }
+ };
+ var qmark = "[^/]";
+ var star = qmark + "*?";
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
+ var reSpecials = charSet("().*{}+?[]^$\\!");
+ function charSet(s) {
+ return s.split("").reduce(function(set, c) {
+ set[c] = true;
+ return set;
+ }, {});
+ }
+ var slashSplit = /\/+/;
+ minimatch.filter = filter;
+ function filter(pattern, options) {
+ options = options || {};
+ return function(p, i, list) {
+ return minimatch(p, pattern, options);
+ };
+ }
+ function ext(a, b) {
+ b = b || {};
+ var t = {};
+ Object.keys(a).forEach(function(k) {
+ t[k] = a[k];
+ });
+ Object.keys(b).forEach(function(k) {
+ t[k] = b[k];
+ });
+ return t;
+ }
+ minimatch.defaults = function(def) {
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
+ return minimatch;
+ }
+ var orig = minimatch;
+ var m = function minimatch2(p, pattern, options) {
+ return orig(p, pattern, ext(def, options));
+ };
+ m.Minimatch = function Minimatch2(pattern, options) {
+ return new orig.Minimatch(pattern, ext(def, options));
+ };
+ m.Minimatch.defaults = function defaults(options) {
+ return orig.defaults(ext(def, options)).Minimatch;
+ };
+ m.filter = function filter2(pattern, options) {
+ return orig.filter(pattern, ext(def, options));
+ };
+ m.defaults = function defaults(options) {
+ return orig.defaults(ext(def, options));
+ };
+ m.makeRe = function makeRe2(pattern, options) {
+ return orig.makeRe(pattern, ext(def, options));
+ };
+ m.braceExpand = function braceExpand2(pattern, options) {
+ return orig.braceExpand(pattern, ext(def, options));
+ };
+ m.match = function(list, pattern, options) {
+ return orig.match(list, pattern, ext(def, options));
+ };
+ return m;
+ };
+ Minimatch.defaults = function(def) {
+ return minimatch.defaults(def).Minimatch;
+ };
+ function minimatch(p, pattern, options) {
+ assertValidPattern(pattern);
+ if (!options) options = {};
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ return false;
+ }
+ return new Minimatch(pattern, options).match(p);
+ }
+ function Minimatch(pattern, options) {
+ if (!(this instanceof Minimatch)) {
+ return new Minimatch(pattern, options);
+ }
+ assertValidPattern(pattern);
+ if (!options) options = {};
+ pattern = pattern.trim();
+ if (!options.allowWindowsEscape && path.sep !== "/") {
+ pattern = pattern.split(path.sep).join("/");
+ }
+ this.options = options;
+ this.set = [];
+ this.pattern = pattern;
+ this.regexp = null;
+ this.negate = false;
+ this.comment = false;
+ this.empty = false;
+ this.partial = !!options.partial;
+ this.make();
+ }
+ Minimatch.prototype.debug = function() {
+ };
+ Minimatch.prototype.make = make;
+ function make() {
+ var pattern = this.pattern;
+ var options = this.options;
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ this.comment = true;
+ return;
+ }
+ if (!pattern) {
+ this.empty = true;
+ return;
+ }
+ this.parseNegate();
+ var set = this.globSet = this.braceExpand();
+ if (options.debug) this.debug = function debug2() {
+ console.error.apply(console, arguments);
+ };
+ this.debug(this.pattern, set);
+ set = this.globParts = set.map(function(s) {
+ return s.split(slashSplit);
+ });
+ this.debug(this.pattern, set);
+ set = set.map(function(s, si, set2) {
+ return s.map(this.parse, this);
+ }, this);
+ this.debug(this.pattern, set);
+ set = set.filter(function(s) {
+ return s.indexOf(false) === -1;
+ });
+ this.debug(this.pattern, set);
+ this.set = set;
+ }
+ Minimatch.prototype.parseNegate = parseNegate;
+ function parseNegate() {
+ var pattern = this.pattern;
+ var negate = false;
+ var options = this.options;
+ var negateOffset = 0;
+ if (options.nonegate) return;
+ for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
+ negate = !negate;
+ negateOffset++;
+ }
+ if (negateOffset) this.pattern = pattern.substr(negateOffset);
+ this.negate = negate;
+ }
+ minimatch.braceExpand = function(pattern, options) {
+ return braceExpand(pattern, options);
+ };
+ Minimatch.prototype.braceExpand = braceExpand;
+ function braceExpand(pattern, options) {
+ if (!options) {
+ if (this instanceof Minimatch) {
+ options = this.options;
+ } else {
+ options = {};
+ }
+ }
+ pattern = typeof pattern === "undefined" ? this.pattern : pattern;
+ assertValidPattern(pattern);
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
+ return [pattern];
+ }
+ return expand2(pattern);
+ }
+ var MAX_PATTERN_LENGTH = 1024 * 64;
+ var assertValidPattern = function(pattern) {
+ if (typeof pattern !== "string") {
+ throw new TypeError("invalid pattern");
+ }
+ if (pattern.length > MAX_PATTERN_LENGTH) {
+ throw new TypeError("pattern is too long");
+ }
+ };
+ Minimatch.prototype.parse = parse2;
+ var SUBPARSE = {};
+ function parse2(pattern, isSub) {
+ assertValidPattern(pattern);
+ var options = this.options;
+ if (pattern === "**") {
+ if (!options.noglobstar)
+ return GLOBSTAR;
+ else
+ pattern = "*";
+ }
+ if (pattern === "") return "";
+ var re = "";
+ var hasMagic = !!options.nocase;
+ var escaping = false;
+ var patternListStack = [];
+ var negativeLists = [];
+ var stateChar;
+ var inClass = false;
+ var reClassStart = -1;
+ var classStart = -1;
+ var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
+ var self = this;
+ function clearStateChar() {
+ if (stateChar) {
+ switch (stateChar) {
+ case "*":
+ re += star;
+ hasMagic = true;
+ break;
+ case "?":
+ re += qmark;
+ hasMagic = true;
+ break;
+ default:
+ re += "\\" + stateChar;
+ break;
+ }
+ self.debug("clearStateChar %j %j", stateChar, re);
+ stateChar = false;
+ }
+ }
+ for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
+ this.debug("%s %s %s %j", pattern, i, re, c);
+ if (escaping && reSpecials[c]) {
+ re += "\\" + c;
+ escaping = false;
+ continue;
+ }
+ switch (c) {
+ /* istanbul ignore next */
+ case "/": {
+ return false;
+ }
+ case "\\":
+ clearStateChar();
+ escaping = true;
+ continue;
+ // the various stateChar values
+ // for the "extglob" stuff.
+ case "?":
+ case "*":
+ case "+":
+ case "@":
+ case "!":
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
+ if (inClass) {
+ this.debug(" in class");
+ if (c === "!" && i === classStart + 1) c = "^";
+ re += c;
+ continue;
+ }
+ self.debug("call clearStateChar %j", stateChar);
+ clearStateChar();
+ stateChar = c;
+ if (options.noext) clearStateChar();
+ continue;
+ case "(":
+ if (inClass) {
+ re += "(";
+ continue;
+ }
+ if (!stateChar) {
+ re += "\\(";
+ continue;
+ }
+ patternListStack.push({
+ type: stateChar,
+ start: i - 1,
+ reStart: re.length,
+ open: plTypes[stateChar].open,
+ close: plTypes[stateChar].close
+ });
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
+ this.debug("plType %j %j", stateChar, re);
+ stateChar = false;
+ continue;
+ case ")":
+ if (inClass || !patternListStack.length) {
+ re += "\\)";
+ continue;
+ }
+ clearStateChar();
+ hasMagic = true;
+ var pl = patternListStack.pop();
+ re += pl.close;
+ if (pl.type === "!") {
+ negativeLists.push(pl);
+ }
+ pl.reEnd = re.length;
+ continue;
+ case "|":
+ if (inClass || !patternListStack.length || escaping) {
+ re += "\\|";
+ escaping = false;
+ continue;
+ }
+ clearStateChar();
+ re += "|";
+ continue;
+ // these are mostly the same in regexp and glob
+ case "[":
+ clearStateChar();
+ if (inClass) {
+ re += "\\" + c;
+ continue;
+ }
+ inClass = true;
+ classStart = i;
+ reClassStart = re.length;
+ re += c;
+ continue;
+ case "]":
+ if (i === classStart + 1 || !inClass) {
+ re += "\\" + c;
+ escaping = false;
+ continue;
+ }
+ var cs = pattern.substring(classStart + 1, i);
+ try {
+ RegExp("[" + cs + "]");
+ } catch (er) {
+ var sp = this.parse(cs, SUBPARSE);
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
+ hasMagic = hasMagic || sp[1];
+ inClass = false;
+ continue;
+ }
+ hasMagic = true;
+ inClass = false;
+ re += c;
+ continue;
+ default:
+ clearStateChar();
+ if (escaping) {
+ escaping = false;
+ } else if (reSpecials[c] && !(c === "^" && inClass)) {
+ re += "\\";
+ }
+ re += c;
+ }
+ }
+ if (inClass) {
+ cs = pattern.substr(classStart + 1);
+ sp = this.parse(cs, SUBPARSE);
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
+ hasMagic = hasMagic || sp[1];
+ }
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
+ var tail = re.slice(pl.reStart + pl.open.length);
+ this.debug("setting tail", re, pl);
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
+ if (!$2) {
+ $2 = "\\";
+ }
+ return $1 + $1 + $2 + "|";
+ });
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
+ var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
+ hasMagic = true;
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
+ }
+ clearStateChar();
+ if (escaping) {
+ re += "\\\\";
+ }
+ var addPatternStart = false;
+ switch (re.charAt(0)) {
+ case "[":
+ case ".":
+ case "(":
+ addPatternStart = true;
+ }
+ for (var n = negativeLists.length - 1; n > -1; n--) {
+ var nl = negativeLists[n];
+ var nlBefore = re.slice(0, nl.reStart);
+ var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
+ var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
+ var nlAfter = re.slice(nl.reEnd);
+ nlLast += nlAfter;
+ var openParensBefore = nlBefore.split("(").length - 1;
+ var cleanAfter = nlAfter;
+ for (i = 0; i < openParensBefore; i++) {
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
+ }
+ nlAfter = cleanAfter;
+ var dollar = "";
+ if (nlAfter === "" && isSub !== SUBPARSE) {
+ dollar = "$";
+ }
+ var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
+ re = newRe;
+ }
+ if (re !== "" && hasMagic) {
+ re = "(?=.)" + re;
+ }
+ if (addPatternStart) {
+ re = patternStart + re;
+ }
+ if (isSub === SUBPARSE) {
+ return [re, hasMagic];
+ }
+ if (!hasMagic) {
+ return globUnescape(pattern);
+ }
+ var flags = options.nocase ? "i" : "";
+ try {
+ var regExp = new RegExp("^" + re + "$", flags);
+ } catch (er) {
+ return new RegExp("$.");
+ }
+ regExp._glob = pattern;
+ regExp._src = re;
+ return regExp;
+ }
+ minimatch.makeRe = function(pattern, options) {
+ return new Minimatch(pattern, options || {}).makeRe();
+ };
+ Minimatch.prototype.makeRe = makeRe;
+ function makeRe() {
+ if (this.regexp || this.regexp === false) return this.regexp;
+ var set = this.set;
+ if (!set.length) {
+ this.regexp = false;
+ return this.regexp;
+ }
+ var options = this.options;
+ var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
+ var flags = options.nocase ? "i" : "";
+ var re = set.map(function(pattern) {
+ return pattern.map(function(p) {
+ return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
+ }).join("\\/");
+ }).join("|");
+ re = "^(?:" + re + ")$";
+ if (this.negate) re = "^(?!" + re + ").*$";
+ try {
+ this.regexp = new RegExp(re, flags);
+ } catch (ex) {
+ this.regexp = false;
+ }
+ return this.regexp;
+ }
+ minimatch.match = function(list, pattern, options) {
+ options = options || {};
+ var mm = new Minimatch(pattern, options);
+ list = list.filter(function(f) {
+ return mm.match(f);
+ });
+ if (mm.options.nonull && !list.length) {
+ list.push(pattern);
+ }
+ return list;
+ };
+ Minimatch.prototype.match = function match(f, partial) {
+ if (typeof partial === "undefined") partial = this.partial;
+ this.debug("match", f, this.pattern);
+ if (this.comment) return false;
+ if (this.empty) return f === "";
+ if (f === "/" && partial) return true;
+ var options = this.options;
+ if (path.sep !== "/") {
+ f = f.split(path.sep).join("/");
+ }
+ f = f.split(slashSplit);
+ this.debug(this.pattern, "split", f);
+ var set = this.set;
+ this.debug(this.pattern, "set", set);
+ var filename;
+ var i;
+ for (i = f.length - 1; i >= 0; i--) {
+ filename = f[i];
+ if (filename) break;
+ }
+ for (i = 0; i < set.length; i++) {
+ var pattern = set[i];
+ var file = f;
+ if (options.matchBase && pattern.length === 1) {
+ file = [filename];
+ }
+ var hit = this.matchOne(file, pattern, partial);
+ if (hit) {
+ if (options.flipNegate) return true;
+ return !this.negate;
+ }
+ }
+ if (options.flipNegate) return false;
+ return this.negate;
+ };
+ Minimatch.prototype.matchOne = function(file, pattern, partial) {
+ var options = this.options;
+ this.debug(
+ "matchOne",
+ { "this": this, file, pattern }
+ );
+ this.debug("matchOne", file.length, pattern.length);
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
+ this.debug("matchOne loop");
+ var p = pattern[pi];
+ var f = file[fi];
+ this.debug(pattern, p, f);
+ if (p === false) return false;
+ if (p === GLOBSTAR) {
+ this.debug("GLOBSTAR", [pattern, p, f]);
+ var fr = fi;
+ var pr = pi + 1;
+ if (pr === pl) {
+ this.debug("** at the end");
+ for (; fi < fl; fi++) {
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
+ }
+ return true;
+ }
+ while (fr < fl) {
+ var swallowee = file[fr];
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
+ this.debug("globstar found match!", fr, fl, swallowee);
+ return true;
+ } else {
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
+ this.debug("dot detected!", file, fr, pattern, pr);
+ break;
+ }
+ this.debug("globstar swallow a segment, and continue");
+ fr++;
+ }
+ }
+ if (partial) {
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
+ if (fr === fl) return true;
+ }
+ return false;
+ }
+ var hit;
+ if (typeof p === "string") {
+ hit = f === p;
+ this.debug("string match", p, f, hit);
+ } else {
+ hit = f.match(p);
+ this.debug("pattern match", p, f, hit);
+ }
+ if (!hit) return false;
+ }
+ if (fi === fl && pi === pl) {
+ return true;
+ } else if (fi === fl) {
+ return partial;
+ } else if (pi === pl) {
+ return fi === fl - 1 && file[fi] === "";
+ }
+ throw new Error("wtf?");
+ };
+ function globUnescape(s) {
+ return s.replace(/\\(.)/g, "$1");
+ }
+ function regExpEscape(s) {
+ return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+ }
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-path.js
+var require_internal_path = __commonJS({
+ "node_modules/@actions/glob/lib/internal-path.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports && exports.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.Path = void 0;
+ var path = __importStar(__require("path"));
+ var pathHelper = __importStar(require_internal_path_helper());
+ var assert_1 = __importDefault(__require("assert"));
+ var IS_WINDOWS = process.platform === "win32";
+ var Path = class {
+ /**
+ * Constructs a Path
+ * @param itemPath Path or array of segments
+ */
+ constructor(itemPath) {
+ this.segments = [];
+ if (typeof itemPath === "string") {
+ (0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ if (!pathHelper.hasRoot(itemPath)) {
+ this.segments = itemPath.split(path.sep);
+ } else {
+ let remaining = itemPath;
+ let dir = pathHelper.dirname(remaining);
+ while (dir !== remaining) {
+ const basename = path.basename(remaining);
+ this.segments.unshift(basename);
+ remaining = dir;
+ dir = pathHelper.dirname(remaining);
+ }
+ this.segments.unshift(remaining);
+ }
+ } else {
+ (0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
+ for (let i = 0; i < itemPath.length; i++) {
+ let segment = itemPath[i];
+ (0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`);
+ segment = pathHelper.normalizeSeparators(itemPath[i]);
+ if (i === 0 && pathHelper.hasRoot(segment)) {
+ segment = pathHelper.safeTrimTrailingSeparator(segment);
+ (0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
+ this.segments.push(segment);
+ } else {
+ (0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
+ this.segments.push(segment);
+ }
+ }
+ }
+ }
+ /**
+ * Converts the path to it's string representation
+ */
+ toString() {
+ let result = this.segments[0];
+ let skipSlash = result.endsWith(path.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result);
+ for (let i = 1; i < this.segments.length; i++) {
+ if (skipSlash) {
+ skipSlash = false;
+ } else {
+ result += path.sep;
+ }
+ result += this.segments[i];
+ }
+ return result;
+ }
+ };
+ exports.Path = Path;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-pattern.js
+var require_internal_pattern = __commonJS({
+ "node_modules/@actions/glob/lib/internal-pattern.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __importDefault = exports && exports.__importDefault || function(mod) {
+ return mod && mod.__esModule ? mod : { "default": mod };
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.Pattern = void 0;
+ var os = __importStar(__require("os"));
+ var path = __importStar(__require("path"));
+ var pathHelper = __importStar(require_internal_path_helper());
+ var assert_1 = __importDefault(__require("assert"));
+ var minimatch_1 = require_minimatch();
+ var internal_match_kind_1 = require_internal_match_kind();
+ var internal_path_1 = require_internal_path();
+ var IS_WINDOWS = process.platform === "win32";
+ var Pattern = class _Pattern {
+ constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) {
+ this.negate = false;
+ let pattern;
+ if (typeof patternOrNegate === "string") {
+ pattern = patternOrNegate.trim();
+ } else {
+ segments = segments || [];
+ (0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
+ const root = _Pattern.getLiteral(segments[0]);
+ (0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
+ pattern = new internal_path_1.Path(segments).toString().trim();
+ if (patternOrNegate) {
+ pattern = `!${pattern}`;
+ }
+ }
+ while (pattern.startsWith("!")) {
+ this.negate = !this.negate;
+ pattern = pattern.substr(1).trim();
+ }
+ pattern = _Pattern.fixupPattern(pattern, homedir);
+ this.segments = new internal_path_1.Path(pattern).segments;
+ this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path.sep);
+ pattern = pathHelper.safeTrimTrailingSeparator(pattern);
+ let foundGlob = false;
+ const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === ""));
+ this.searchPath = new internal_path_1.Path(searchSegments).toString();
+ this.rootRegExp = new RegExp(_Pattern.regExpEscape(searchSegments[0]), IS_WINDOWS ? "i" : "");
+ this.isImplicitPattern = isImplicitPattern;
+ const minimatchOptions = {
+ dot: true,
+ nobrace: true,
+ nocase: IS_WINDOWS,
+ nocomment: true,
+ noext: true,
+ nonegate: true
+ };
+ pattern = IS_WINDOWS ? pattern.replace(/\\/g, "/") : pattern;
+ this.minimatch = new minimatch_1.Minimatch(pattern, minimatchOptions);
+ }
+ /**
+ * Matches the pattern against the specified path
+ */
+ match(itemPath) {
+ if (this.segments[this.segments.length - 1] === "**") {
+ itemPath = pathHelper.normalizeSeparators(itemPath);
+ if (!itemPath.endsWith(path.sep) && this.isImplicitPattern === false) {
+ itemPath = `${itemPath}${path.sep}`;
+ }
+ } else {
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ }
+ if (this.minimatch.match(itemPath)) {
+ return this.trailingSeparator ? internal_match_kind_1.MatchKind.Directory : internal_match_kind_1.MatchKind.All;
+ }
+ return internal_match_kind_1.MatchKind.None;
+ }
+ /**
+ * Indicates whether the pattern may match descendants of the specified path
+ */
+ partialMatch(itemPath) {
+ itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
+ if (pathHelper.dirname(itemPath) === itemPath) {
+ return this.rootRegExp.test(itemPath);
+ }
+ return this.minimatch.matchOne(itemPath.split(IS_WINDOWS ? /\\+/ : /\/+/), this.minimatch.set[0], true);
+ }
+ /**
+ * Escapes glob patterns within a path
+ */
+ static globEscape(s) {
+ return (IS_WINDOWS ? s : s.replace(/\\/g, "\\\\")).replace(/(\[)(?=[^/]+\])/g, "[[]").replace(/\?/g, "[?]").replace(/\*/g, "[*]");
+ }
+ /**
+ * Normalizes slashes and ensures absolute root
+ */
+ static fixupPattern(pattern, homedir) {
+ (0, assert_1.default)(pattern, "pattern cannot be empty");
+ const literalSegments = new internal_path_1.Path(pattern).segments.map((x) => _Pattern.getLiteral(x));
+ (0, assert_1.default)(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
+ (0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
+ pattern = pathHelper.normalizeSeparators(pattern);
+ if (pattern === "." || pattern.startsWith(`.${path.sep}`)) {
+ pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1);
+ } else if (pattern === "~" || pattern.startsWith(`~${path.sep}`)) {
+ homedir = homedir || os.homedir();
+ (0, assert_1.default)(homedir, "Unable to determine HOME directory");
+ (0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
+ pattern = _Pattern.globEscape(homedir) + pattern.substr(1);
+ } else if (IS_WINDOWS && (pattern.match(/^[A-Z]:$/i) || pattern.match(/^[A-Z]:[^\\]/i))) {
+ let root = pathHelper.ensureAbsoluteRoot("C:\\dummy-root", pattern.substr(0, 2));
+ if (pattern.length > 2 && !root.endsWith("\\")) {
+ root += "\\";
+ }
+ pattern = _Pattern.globEscape(root) + pattern.substr(2);
+ } else if (IS_WINDOWS && (pattern === "\\" || pattern.match(/^\\[^\\]/))) {
+ let root = pathHelper.ensureAbsoluteRoot("C:\\dummy-root", "\\");
+ if (!root.endsWith("\\")) {
+ root += "\\";
+ }
+ pattern = _Pattern.globEscape(root) + pattern.substr(1);
+ } else {
+ pattern = pathHelper.ensureAbsoluteRoot(_Pattern.globEscape(process.cwd()), pattern);
+ }
+ return pathHelper.normalizeSeparators(pattern);
+ }
+ /**
+ * Attempts to unescape a pattern segment to create a literal path segment.
+ * Otherwise returns empty string.
+ */
+ static getLiteral(segment) {
+ let literal = "";
+ for (let i = 0; i < segment.length; i++) {
+ const c = segment[i];
+ if (c === "\\" && !IS_WINDOWS && i + 1 < segment.length) {
+ literal += segment[++i];
+ continue;
+ } else if (c === "*" || c === "?") {
+ return "";
+ } else if (c === "[" && i + 1 < segment.length) {
+ let set = "";
+ let closed = -1;
+ for (let i2 = i + 1; i2 < segment.length; i2++) {
+ const c2 = segment[i2];
+ if (c2 === "\\" && !IS_WINDOWS && i2 + 1 < segment.length) {
+ set += segment[++i2];
+ continue;
+ } else if (c2 === "]") {
+ closed = i2;
+ break;
+ } else {
+ set += c2;
+ }
+ }
+ if (closed >= 0) {
+ if (set.length > 1) {
+ return "";
+ }
+ if (set) {
+ literal += set;
+ i = closed;
+ continue;
+ }
+ }
+ }
+ literal += c;
+ }
+ return literal;
+ }
+ /**
+ * Escapes regexp special characters
+ * https://javascript.info/regexp-escaping
+ */
+ static regExpEscape(s) {
+ return s.replace(/[[\\^$.|?*+()]/g, "\\$&");
+ }
+ };
+ exports.Pattern = Pattern;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-search-state.js
+var require_internal_search_state = __commonJS({
+ "node_modules/@actions/glob/lib/internal-search-state.js"(exports) {
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.SearchState = void 0;
+ var SearchState = class {
+ constructor(path, level) {
+ this.path = path;
+ this.level = level;
+ }
+ };
+ exports.SearchState = SearchState;
+ }
+});
+
+// node_modules/@actions/glob/lib/internal-globber.js
+var require_internal_globber = __commonJS({
+ "node_modules/@actions/glob/lib/internal-globber.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __awaiter = exports && exports.__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());
+ });
+ };
+ var __asyncValues = exports && exports.__asyncValues || function(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i);
+ function verb(n) {
+ i[n] = o[n] && function(v) {
+ return new Promise(function(resolve, reject) {
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
+ });
+ };
+ }
+ function settle(resolve, reject, d, v) {
+ Promise.resolve(v).then(function(v2) {
+ resolve({ value: v2, done: d });
+ }, reject);
+ }
+ };
+ var __await = exports && exports.__await || function(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+ };
+ var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i;
+ function verb(n) {
+ if (g[n]) i[n] = function(v) {
+ return new Promise(function(a, b) {
+ q.push([n, v, a, b]) > 1 || resume(n, v);
+ });
+ };
+ }
+ function resume(n, v) {
+ try {
+ step(g[n](v));
+ } catch (e) {
+ settle(q[0][3], e);
+ }
+ }
+ function step(r) {
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
+ }
+ function fulfill(value) {
+ resume("next", value);
+ }
+ function reject(value) {
+ resume("throw", value);
+ }
+ function settle(f, v) {
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
+ }
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.DefaultGlobber = void 0;
+ var core = __importStar(require_core());
+ var fs = __importStar(__require("fs"));
+ var globOptionsHelper = __importStar(require_internal_glob_options_helper());
+ var path = __importStar(__require("path"));
+ var patternHelper = __importStar(require_internal_pattern_helper());
+ var internal_match_kind_1 = require_internal_match_kind();
+ var internal_pattern_1 = require_internal_pattern();
+ var internal_search_state_1 = require_internal_search_state();
+ var IS_WINDOWS = process.platform === "win32";
+ var DefaultGlobber = class _DefaultGlobber {
+ constructor(options) {
+ this.patterns = [];
+ this.searchPaths = [];
+ this.options = globOptionsHelper.getOptions(options);
+ }
+ getSearchPaths() {
+ return this.searchPaths.slice();
+ }
+ glob() {
+ var _a2, e_1, _b, _c;
+ return __awaiter(this, void 0, void 0, function* () {
+ const result = [];
+ try {
+ for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a2 = _f.done, !_a2; _d = true) {
+ _c = _f.value;
+ _d = false;
+ const itemPath = _c;
+ result.push(itemPath);
+ }
+ } catch (e_1_1) {
+ e_1 = { error: e_1_1 };
+ } finally {
+ try {
+ if (!_d && !_a2 && (_b = _e.return)) yield _b.call(_e);
+ } finally {
+ if (e_1) throw e_1.error;
+ }
+ }
+ return result;
+ });
+ }
+ globGenerator() {
+ return __asyncGenerator(this, arguments, function* globGenerator_1() {
+ const options = globOptionsHelper.getOptions(this.options);
+ const patterns = [];
+ for (const pattern of this.patterns) {
+ patterns.push(pattern);
+ if (options.implicitDescendants && (pattern.trailingSeparator || pattern.segments[pattern.segments.length - 1] !== "**")) {
+ patterns.push(new internal_pattern_1.Pattern(pattern.negate, true, pattern.segments.concat("**")));
+ }
+ }
+ const stack = [];
+ for (const searchPath of patternHelper.getSearchPaths(patterns)) {
+ core.debug(`Search path '${searchPath}'`);
+ try {
+ yield __await(fs.promises.lstat(searchPath));
+ } catch (err) {
+ if (err.code === "ENOENT") {
+ continue;
+ }
+ throw err;
+ }
+ stack.unshift(new internal_search_state_1.SearchState(searchPath, 1));
+ }
+ const traversalChain = [];
+ while (stack.length) {
+ const item = stack.pop();
+ const match = patternHelper.match(patterns, item.path);
+ const partialMatch = !!match || patternHelper.partialMatch(patterns, item.path);
+ if (!match && !partialMatch) {
+ continue;
+ }
+ const stats = yield __await(
+ _DefaultGlobber.stat(item, options, traversalChain)
+ // Broken symlink, or symlink cycle detected, or no longer exists
+ );
+ if (!stats) {
+ continue;
+ }
+ if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
+ continue;
+ }
+ if (stats.isDirectory()) {
+ if (match & internal_match_kind_1.MatchKind.Directory && options.matchDirectories) {
+ yield yield __await(item.path);
+ } else if (!partialMatch) {
+ continue;
+ }
+ const childLevel = item.level + 1;
+ const childItems = (yield __await(fs.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path.join(item.path, x), childLevel));
+ stack.push(...childItems.reverse());
+ } else if (match & internal_match_kind_1.MatchKind.File) {
+ yield yield __await(item.path);
+ }
+ }
+ });
+ }
+ /**
+ * Constructs a DefaultGlobber
+ */
+ static create(patterns, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const result = new _DefaultGlobber(options);
+ if (IS_WINDOWS) {
+ patterns = patterns.replace(/\r\n/g, "\n");
+ patterns = patterns.replace(/\r/g, "\n");
+ }
+ const lines = patterns.split("\n").map((x) => x.trim());
+ for (const line of lines) {
+ if (!line || line.startsWith("#")) {
+ continue;
+ } else {
+ result.patterns.push(new internal_pattern_1.Pattern(line));
+ }
+ }
+ result.searchPaths.push(...patternHelper.getSearchPaths(result.patterns));
+ return result;
+ });
+ }
+ static stat(item, options, traversalChain) {
+ return __awaiter(this, void 0, void 0, function* () {
+ let stats;
+ if (options.followSymbolicLinks) {
+ try {
+ stats = yield fs.promises.stat(item.path);
+ } catch (err) {
+ if (err.code === "ENOENT") {
+ if (options.omitBrokenSymbolicLinks) {
+ core.debug(`Broken symlink '${item.path}'`);
+ return void 0;
+ }
+ throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`);
+ }
+ throw err;
+ }
+ } else {
+ stats = yield fs.promises.lstat(item.path);
+ }
+ if (stats.isDirectory() && options.followSymbolicLinks) {
+ const realPath = yield fs.promises.realpath(item.path);
+ while (traversalChain.length >= item.level) {
+ traversalChain.pop();
+ }
+ if (traversalChain.some((x) => x === realPath)) {
+ core.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`);
+ return void 0;
+ }
+ traversalChain.push(realPath);
+ }
+ return stats;
+ });
+ }
+ };
+ exports.DefaultGlobber = DefaultGlobber;
+ }
+});
-`;
- content += `- size: ${formatValue(contractBefore?.deployment.size, item.deployment.size)} / 49152
+// node_modules/@actions/glob/lib/internal-hash-files.js
+var require_internal_hash_files = __commonJS({
+ "node_modules/@actions/glob/lib/internal-hash-files.js"(exports) {
+ "use strict";
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() {
+ return m[k];
+ } };
+ }
+ Object.defineProperty(o, k2, desc);
+ } : function(o, m, k, k2) {
+ if (k2 === void 0) k2 = k;
+ o[k2] = m[k];
+ });
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+ } : function(o, v) {
+ o["default"] = v;
+ });
+ var __importStar = exports && exports.__importStar || function(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) {
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ }
+ __setModuleDefault(result, mod);
+ return result;
+ };
+ var __awaiter = exports && exports.__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());
+ });
+ };
+ var __asyncValues = exports && exports.__asyncValues || function(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
+ return this;
+ }, i);
+ function verb(n) {
+ i[n] = o[n] && function(v) {
+ return new Promise(function(resolve, reject) {
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
+ });
+ };
+ }
+ function settle(resolve, reject, d, v) {
+ Promise.resolve(v).then(function(v2) {
+ resolve({ value: v2, done: d });
+ }, reject);
+ }
+ };
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.hashFiles = void 0;
+ var crypto = __importStar(__require("crypto"));
+ var core = __importStar(require_core());
+ var fs = __importStar(__require("fs"));
+ var stream = __importStar(__require("stream"));
+ var util = __importStar(__require("util"));
+ var path = __importStar(__require("path"));
+ function hashFiles(globber, currentWorkspace, verbose = false) {
+ var _a2, e_1, _b, _c;
+ var _d;
+ return __awaiter(this, void 0, void 0, function* () {
+ const writeDelegate = verbose ? core.info : core.debug;
+ let hasMatch = false;
+ const githubWorkspace = currentWorkspace ? currentWorkspace : (_d = process.env["GITHUB_WORKSPACE"]) !== null && _d !== void 0 ? _d : process.cwd();
+ const result = crypto.createHash("sha256");
+ let count = 0;
+ try {
+ for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a2 = _g.done, !_a2; _e = true) {
+ _c = _g.value;
+ _e = false;
+ const file = _c;
+ writeDelegate(file);
+ if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
+ writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
+ continue;
+ }
+ if (fs.statSync(file).isDirectory()) {
+ writeDelegate(`Skip directory '${file}'.`);
+ continue;
+ }
+ const hash = crypto.createHash("sha256");
+ const pipeline = util.promisify(stream.pipeline);
+ yield pipeline(fs.createReadStream(file), hash);
+ result.write(hash.digest());
+ count++;
+ if (!hasMatch) {
+ hasMatch = true;
+ }
+ }
+ } catch (e_1_1) {
+ e_1 = { error: e_1_1 };
+ } finally {
+ try {
+ if (!_e && !_a2 && (_b = _f.return)) yield _b.call(_f);
+ } finally {
+ if (e_1) throw e_1.error;
+ }
+ }
+ result.end();
+ if (hasMatch) {
+ writeDelegate(`Found ${count} files to hash.`);
+ return result.digest("hex");
+ } else {
+ writeDelegate(`No matches found for glob`);
+ return "";
+ }
+ });
+ }
+ exports.hashFiles = hashFiles;
+ }
+});
-`;
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item.functions) === JSON.stringify(contractBefore.functions))
- return;
- else {
- let rows = `| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-`;
- Object.entries(item.functions).map(([method, values]) => {
- const before2 = contractBefore && findFunction(method, contractBefore.functions);
- if (options.ignoreUnchanged && before2 && JSON.stringify(before2) === JSON.stringify(values))
- return;
- rows += `${method} | ${formatValue(before2?.min, values.min)} | ${formatValue(before2?.mean, values.mean)} | ${formatValue(before2?.median, values.median)} | ${formatValue(before2?.max, values.max)} | ${formatValue(before2?.calls, values.calls)} |
-`;
+// node_modules/@actions/glob/lib/glob.js
+var require_glob = __commonJS({
+ "node_modules/@actions/glob/lib/glob.js"(exports) {
+ "use strict";
+ var __awaiter = exports && exports.__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.hashFiles = exports.create = void 0;
+ var internal_globber_1 = require_internal_globber();
+ var internal_hash_files_1 = require_internal_hash_files();
+ function create(patterns, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return yield internal_globber_1.DefaultGlobber.create(patterns, options);
});
- content += rows;
}
- content += "\n\n";
- });
- return content;
-}
+ exports.create = create;
+ function hashFiles(patterns, currentWorkspace = "", options, verbose = false) {
+ return __awaiter(this, void 0, void 0, function* () {
+ let followSymbolicLinks = true;
+ if (options && typeof options.followSymbolicLinks === "boolean") {
+ followSymbolicLinks = options.followSymbolicLinks;
+ }
+ const globber = yield create(patterns, { followSymbolicLinks });
+ return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
+ });
+ }
+ exports.hashFiles = hashFiles;
+ }
+});
// src/action.ts
-var root = (0, import_core.getInput)("ROOT_REPORT_PATH");
-var current = (0, import_core.getInput)("REPORT_PATH");
-var rootExists = root && existsSync(root);
-var currentExists = current && existsSync(current);
-if (!currentExists) throw new Error("gas report not found");
-var rootContent = rootExists ? JSON.parse(readFileSync(root, "utf8")) : [];
-var currentContent = JSON.parse(readFileSync(current, "utf8"));
-var table = getHtmlGasReport(rootContent, currentContent, {
- rootUrl: `${import_github.context.payload.repository?.html_url}/blob/${import_github.context.sha}/`,
- ignoreUnchanged: (0, import_core.getInput)("ignoreUnchanged") === "true"
-});
-(0, import_core.setOutput)(
- "report",
- `:fuelpump: Gas report
+var import_core = __toESM(require_core());
+var import_github = __toESM(require_github());
+var import_glob = __toESM(require_glob());
-${table}
+// src/lib.ts
+var numberFormat = new Intl.NumberFormat("en-US");
- `
-);
+// src/action.ts
+var baseBranch = (0, import_core.getInput)("baseBranch");
+var octokit = (0, import_github.getOctokit)((0, import_core.getInput)("token"));
+(0, import_core.debug)(`Base branch: ${baseBranch}`);
/*! Bundled license information:
undici/lib/fetch/body.js:
diff --git a/dist/lib.d.mts b/dist/lib.d.mts
index f6eeeec..8620088 100644
--- a/dist/lib.d.mts
+++ b/dist/lib.d.mts
@@ -1,22 +1,16 @@
-type FunctionSnapshot = {
- calls: number;
- min: number;
- mean: number;
- median: number;
- max: number;
+type Snapshot = Record;
+declare function snapshotDiff({ before, after, }: {
+ before: Snapshot;
+ after: Snapshot;
+}): {
+ removed: Snapshot;
+ added: Snapshot;
+ changed: Snapshot;
+ unchanged: Snapshot;
};
-type GasSnapshot = {
- contract: string;
- deployment: {
- gas: number;
- size: number;
- };
- functions: Record;
-}[];
-type Options = {
- rootUrl?: string;
- ignoreUnchanged?: boolean;
-};
-declare function getHtmlGasReport(before: GasSnapshot, after: GasSnapshot, options?: Options): string;
+declare const formatDiffMd: (input: {
+ path: string;
+ diff: ReturnType;
+}[]) => string;
-export { getHtmlGasReport };
+export { formatDiffMd, snapshotDiff };
diff --git a/dist/lib.d.ts b/dist/lib.d.ts
index f6eeeec..8620088 100644
--- a/dist/lib.d.ts
+++ b/dist/lib.d.ts
@@ -1,22 +1,16 @@
-type FunctionSnapshot = {
- calls: number;
- min: number;
- mean: number;
- median: number;
- max: number;
+type Snapshot = Record;
+declare function snapshotDiff({ before, after, }: {
+ before: Snapshot;
+ after: Snapshot;
+}): {
+ removed: Snapshot;
+ added: Snapshot;
+ changed: Snapshot;
+ unchanged: Snapshot;
};
-type GasSnapshot = {
- contract: string;
- deployment: {
- gas: number;
- size: number;
- };
- functions: Record;
-}[];
-type Options = {
- rootUrl?: string;
- ignoreUnchanged?: boolean;
-};
-declare function getHtmlGasReport(before: GasSnapshot, after: GasSnapshot, options?: Options): string;
+declare const formatDiffMd: (input: {
+ path: string;
+ diff: ReturnType;
+}[]) => string;
-export { getHtmlGasReport };
+export { formatDiffMd, snapshotDiff };
diff --git a/dist/lib.js b/dist/lib.js
index 31701c6..c4632c5 100644
--- a/dist/lib.js
+++ b/dist/lib.js
@@ -20,61 +20,104 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/lib.ts
var lib_exports = {};
__export(lib_exports, {
- getHtmlGasReport: () => getHtmlGasReport
+ formatDiffMd: () => formatDiffMd,
+ snapshotDiff: () => snapshotDiff
});
module.exports = __toCommonJS(lib_exports);
-var UP = `\u2191`;
-var DOWN = `\u2193`;
-function findContract(contract, snapshot) {
- return snapshot.find((item) => item.contract === contract);
-}
-function findFunction(fn, snapshot) {
- return snapshot[fn];
-}
-function formatValue(before, after) {
- if (!before || after === before) return after;
- const diff = (after - before) / Math.abs(before) * 100;
- if (Math.abs(diff) < 0.1) return after;
- return `${diff > 0 ? UP : DOWN}${new Intl.NumberFormat(
- "en-US",
- {
- maximumSignificantDigits: 2
+var numberFormat = new Intl.NumberFormat("en-US");
+var formatNumber = (value) => {
+ return numberFormat.format(Number(value));
+};
+function snapshotDiff({
+ before,
+ after
+}) {
+ const removed = {};
+ const added = {};
+ const changed = {};
+ const unchanged = {};
+ const beforeKeys = Object.keys(before);
+ const afterKeys = Object.keys(after);
+ const beforeNotNumbers = beforeKeys.filter(
+ (key) => Number.isNaN(Number(before[key]))
+ );
+ const afterNotNumbers = afterKeys.filter(
+ (key) => Number.isNaN(Number(after[key]))
+ );
+ if (beforeNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in before are not numbers: ${beforeNotNumbers.join(", ")}`
+ );
+ }
+ if (afterNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in after are not numbers: ${afterNotNumbers.join(", ")}`
+ );
+ }
+ for (const _key of beforeKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+ if (!after_value) {
+ removed[key] = formatNumber(before_value);
+ } else if (before_value !== after_value) {
+ const diff = Math.abs(Number(before_value) - Number(after_value));
+ const diffPercentage = Math.round(diff / Number(before_value) * 100);
+ const diffSym = Number(before_value) < Number(after_value) ? "\u2191" : "\u2193";
+ const diffSign = Number(before_value) < Number(after_value) ? "+" : "-";
+ changed[key] = `${diffSym}${diffPercentage}% (${diffSign}${diff}) ${formatNumber(after_value)}`;
+ } else {
+ unchanged[key] = formatNumber(before_value);
}
- ).format(diff)}%${after}`;
-}
-function getHtmlGasReport(before, after, options = {}) {
- let content = "";
- after.map((item) => {
- const contractBefore = findContract(item.contract, before);
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item) === JSON.stringify(contractBefore))
- return;
- const [path, name] = item.contract.split(":");
- content += `### [${name}](${options.rootUrl}${path})
-
-`;
- content += `- size: ${formatValue(contractBefore?.deployment.size, item.deployment.size)} / 49152
-
-`;
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item.functions) === JSON.stringify(contractBefore.functions))
- return;
- else {
- let rows = `| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-`;
- Object.entries(item.functions).map(([method, values]) => {
- const before2 = contractBefore && findFunction(method, contractBefore.functions);
- if (options.ignoreUnchanged && before2 && JSON.stringify(before2) === JSON.stringify(values))
- return;
- rows += `${method} | ${formatValue(before2?.min, values.min)} | ${formatValue(before2?.mean, values.mean)} | ${formatValue(before2?.median, values.median)} | ${formatValue(before2?.max, values.max)} | ${formatValue(before2?.calls, values.calls)} |
-`;
- });
- content += rows;
+ }
+ for (const _key of afterKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+ if (!before_value) {
+ added[key] = after_value;
}
- content += "\n\n";
- });
- return content;
+ }
+ return {
+ removed,
+ added,
+ changed,
+ unchanged
+ };
}
+var formatDiffMd = (input) => {
+ const th = "| Path | Value |";
+ const hr = "| --- | ---: |";
+ const br = "";
+ const changedLines = ["### \u267B\uFE0F Changed", th, hr];
+ const unchangedLines = [
+ br,
+ "\u{1F515} Unchanged
",
+ br,
+ th,
+ hr
+ ];
+ const formatLine = (key, value) => `| ${key} | ${value} |`;
+ const formatGroup = (values) => {
+ return values.map(([key, value]) => formatLine(`${key}`, `${value}`));
+ };
+ for (const { path, diff } of input) {
+ changedLines.push(formatLine(`**${path}**`, ""));
+ const changed = diff.changed;
+ const added = diff.added;
+ const removed = diff.removed;
+ const unchanged = diff.unchanged;
+ changedLines.push(...formatGroup(Object.entries(changed)));
+ changedLines.push(...formatGroup(Object.entries(removed)));
+ changedLines.push(...formatGroup(Object.entries(added)));
+ unchangedLines.push(formatLine(`**${path}**`, ""));
+ unchangedLines.push(...formatGroup(Object.entries(unchanged)));
+ }
+ unchangedLines.push(" ");
+ return [...changedLines, ...unchangedLines].join("\n");
+};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- getHtmlGasReport
+ formatDiffMd,
+ snapshotDiff
});
diff --git a/dist/lib.mjs b/dist/lib.mjs
index 5eab8fe..2eb40d1 100644
--- a/dist/lib.mjs
+++ b/dist/lib.mjs
@@ -1,55 +1,97 @@
// src/lib.ts
-var UP = `\u2191`;
-var DOWN = `\u2193`;
-function findContract(contract, snapshot) {
- return snapshot.find((item) => item.contract === contract);
-}
-function findFunction(fn, snapshot) {
- return snapshot[fn];
-}
-function formatValue(before, after) {
- if (!before || after === before) return after;
- const diff = (after - before) / Math.abs(before) * 100;
- if (Math.abs(diff) < 0.1) return after;
- return `${diff > 0 ? UP : DOWN}${new Intl.NumberFormat(
- "en-US",
- {
- maximumSignificantDigits: 2
+var numberFormat = new Intl.NumberFormat("en-US");
+var formatNumber = (value) => {
+ return numberFormat.format(Number(value));
+};
+function snapshotDiff({
+ before,
+ after
+}) {
+ const removed = {};
+ const added = {};
+ const changed = {};
+ const unchanged = {};
+ const beforeKeys = Object.keys(before);
+ const afterKeys = Object.keys(after);
+ const beforeNotNumbers = beforeKeys.filter(
+ (key) => Number.isNaN(Number(before[key]))
+ );
+ const afterNotNumbers = afterKeys.filter(
+ (key) => Number.isNaN(Number(after[key]))
+ );
+ if (beforeNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in before are not numbers: ${beforeNotNumbers.join(", ")}`
+ );
+ }
+ if (afterNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in after are not numbers: ${afterNotNumbers.join(", ")}`
+ );
+ }
+ for (const _key of beforeKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+ if (!after_value) {
+ removed[key] = formatNumber(before_value);
+ } else if (before_value !== after_value) {
+ const diff = Math.abs(Number(before_value) - Number(after_value));
+ const diffPercentage = Math.round(diff / Number(before_value) * 100);
+ const diffSym = Number(before_value) < Number(after_value) ? "\u2191" : "\u2193";
+ const diffSign = Number(before_value) < Number(after_value) ? "+" : "-";
+ changed[key] = `${diffSym}${diffPercentage}% (${diffSign}${diff}) ${formatNumber(after_value)}`;
+ } else {
+ unchanged[key] = formatNumber(before_value);
}
- ).format(diff)}%${after}`;
-}
-function getHtmlGasReport(before, after, options = {}) {
- let content = "";
- after.map((item) => {
- const contractBefore = findContract(item.contract, before);
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item) === JSON.stringify(contractBefore))
- return;
- const [path, name] = item.contract.split(":");
- content += `### [${name}](${options.rootUrl}${path})
-
-`;
- content += `- size: ${formatValue(contractBefore?.deployment.size, item.deployment.size)} / 49152
-
-`;
- if (options.ignoreUnchanged && contractBefore && JSON.stringify(item.functions) === JSON.stringify(contractBefore.functions))
- return;
- else {
- let rows = `| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-`;
- Object.entries(item.functions).map(([method, values]) => {
- const before2 = contractBefore && findFunction(method, contractBefore.functions);
- if (options.ignoreUnchanged && before2 && JSON.stringify(before2) === JSON.stringify(values))
- return;
- rows += `${method} | ${formatValue(before2?.min, values.min)} | ${formatValue(before2?.mean, values.mean)} | ${formatValue(before2?.median, values.median)} | ${formatValue(before2?.max, values.max)} | ${formatValue(before2?.calls, values.calls)} |
-`;
- });
- content += rows;
+ }
+ for (const _key of afterKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+ if (!before_value) {
+ added[key] = after_value;
}
- content += "\n\n";
- });
- return content;
+ }
+ return {
+ removed,
+ added,
+ changed,
+ unchanged
+ };
}
+var formatDiffMd = (input) => {
+ const th = "| Path | Value |";
+ const hr = "| --- | ---: |";
+ const br = "";
+ const changedLines = ["### \u267B\uFE0F Changed", th, hr];
+ const unchangedLines = [
+ br,
+ "\u{1F515} Unchanged
",
+ br,
+ th,
+ hr
+ ];
+ const formatLine = (key, value) => `| ${key} | ${value} |`;
+ const formatGroup = (values) => {
+ return values.map(([key, value]) => formatLine(`${key}`, `${value}`));
+ };
+ for (const { path, diff } of input) {
+ changedLines.push(formatLine(`**${path}**`, ""));
+ const changed = diff.changed;
+ const added = diff.added;
+ const removed = diff.removed;
+ const unchanged = diff.unchanged;
+ changedLines.push(...formatGroup(Object.entries(changed)));
+ changedLines.push(...formatGroup(Object.entries(removed)));
+ changedLines.push(...formatGroup(Object.entries(added)));
+ unchangedLines.push(formatLine(`**${path}**`, ""));
+ unchangedLines.push(...formatGroup(Object.entries(unchanged)));
+ }
+ unchangedLines.push(" ");
+ return [...changedLines, ...unchangedLines].join("\n");
+};
export {
- getHtmlGasReport
+ formatDiffMd,
+ snapshotDiff
};
diff --git a/mocks/gas.backup.json b/mocks/gas.backup.json
deleted file mode 100644
index 7d37688..0000000
--- a/mocks/gas.backup.json
+++ /dev/null
@@ -1,137 +0,0 @@
-[
- {
- "contract": "src/contracts/create3/Create3Factory.sol:Create3Factory",
- "deployment": { "gas": 224263, "size": 1151 },
- "functions": {
- "create(bytes32,bytes)": {
- "calls": 6,
- "min": 296388,
- "mean": 296666,
- "median": 287062,
- "max": 297068
- },
- "predictAddress(address,bytes32)": {
- "calls": 6,
- "min": 1024,
- "mean": 1024,
- "median": 1024,
- "max": 1024
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/ProxyAdmin.sol:ProxyAdmin",
- "deployment": { "gas": 0, "size": 0 },
- "functions": {
- "owner()": {
- "calls": 6,
- "min": 386,
- "mean": 386,
- "median": 386,
- "max": 386
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/TransparentProxyFactory.sol:TransparentProxyFactory",
- "deployment": { "gas": 1609662, "size": 7244 },
- "functions": {
- "createDeterministic(address,address,bytes,bytes32)": {
- "calls": 6,
- "min": 574115,
- "mean": 534507,
- "median": 574589,
- "max": 574703
- },
- "createDeterministicProxyAdmin(address,bytes32)": {
- "calls": 6,
- "min": 421268,
- "mean": 421658,
- "median": 421850,
- "max": 421856
- },
- "predictCreateDeterministic(address,address,bytes,bytes32)": {
- "calls": 6,
- "min": 12057,
- "mean": 12057,
- "median": 12057,
- "max": 12057
- },
- "predictCreateDeterministicProxyAdmin(bytes32)": {
- "calls": 6,
- "min": 6236,
- "mean": 6236,
- "median": 6236,
- "max": 6236
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
- "deployment": { "gas": 0, "size": 0 },
- "functions": {
- "getFoo()": {
- "calls": 6,
- "min": 1042,
- "mean": 1042,
- "median": 1042,
- "max": 1042
- }
- }
- },
- {
- "contract": "test/OwnableWithGuardian.t.sol:ImplOwnableWithGuardian",
- "deployment": { "gas": 285211, "size": 1067 },
- "functions": {
- "guardian()": {
- "calls": 1,
- "min": 2286,
- "mean": 2286,
- "median": 2286,
- "max": 2286
- },
- "owner()": {
- "calls": 1,
- "min": 2341,
- "mean": 2341,
- "median": 2341,
- "max": 2341
- },
- "updateGuardian(address)": {
- "calls": 6,
- "min": 25944,
- "mean": 28245,
- "median": 28283,
- "max": 30394
- }
- }
- },
- {
- "contract": "test/PermissionlessRescuable.t.sol:TestPermissionlessRescuable",
- "deployment": { "gas": 879072, "size": 4033 },
- "functions": {
- "emergencyEtherTransfer(uint256)": {
- "calls": 2,
- "min": 59057,
- "mean": 59900,
- "median": 59900,
- "max": 60743
- },
- "emergencyTokenTransfer(address,uint256)": {
- "calls": 4,
- "min": 34213,
- "mean": 50627,
- "median": 51185,
- "max": 65925
- },
- "receive()": { "calls": 1, "min": 0, "mean": 0, "median": 0, "max": 0 },
- "whoShouldReceiveFunds()": {
- "calls": 1,
- "min": 2566,
- "mean": 2566,
- "median": 2566,
- "max": 2566
- }
- }
- }
-]
diff --git a/mocks/gas.json b/mocks/gas.json
deleted file mode 100644
index 82988d1..0000000
--- a/mocks/gas.json
+++ /dev/null
@@ -1,137 +0,0 @@
-[
- {
- "contract": "src/contracts/create3/Create3Factory.sol:Create3Factory",
- "deployment": { "gas": 224263, "size": 1151 },
- "functions": {
- "create(bytes32,bytes)": {
- "calls": 6,
- "min": 286388,
- "mean": 296666,
- "median": 287062,
- "max": 397068
- },
- "predictAddress(address,bytes32)": {
- "calls": 6,
- "min": 1024,
- "mean": 1024,
- "median": 1024,
- "max": 1025
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/ProxyAdmin.sol:ProxyAdmin",
- "deployment": { "gas": 0, "size": 0 },
- "functions": {
- "owner()": {
- "calls": 6,
- "min": 386,
- "mean": 386,
- "median": 386,
- "max": 386
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/TransparentProxyFactory.sol:TransparentProxyFactory",
- "deployment": { "gas": 1609662, "size": 8244 },
- "functions": {
- "createDeterministic(address,address,bytes,bytes32)": {
- "calls": 6,
- "min": 574115,
- "mean": 534507,
- "median": 574589,
- "max": 574703
- },
- "createDeterministicProxyAdmin(address,bytes32)": {
- "calls": 6,
- "min": 421268,
- "mean": 421658,
- "median": 421850,
- "max": 421856
- },
- "predictCreateDeterministic(address,address,bytes,bytes32)": {
- "calls": 6,
- "min": 12057,
- "mean": 12057,
- "median": 12057,
- "max": 12057
- },
- "predictCreateDeterministicProxyAdmin(bytes32)": {
- "calls": 6,
- "min": 6236,
- "mean": 6236,
- "median": 6236,
- "max": 6236
- }
- }
- },
- {
- "contract": "src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy",
- "deployment": { "gas": 0, "size": 0 },
- "functions": {
- "getFoo()": {
- "calls": 6,
- "min": 1042,
- "mean": 1042,
- "median": 1042,
- "max": 1042
- }
- }
- },
- {
- "contract": "test/OwnableWithGuardian.t.sol:ImplOwnableWithGuardian",
- "deployment": { "gas": 285211, "size": 1067 },
- "functions": {
- "guardian()": {
- "calls": 1,
- "min": 2286,
- "mean": 2286,
- "median": 2286,
- "max": 2286
- },
- "owner()": {
- "calls": 1,
- "min": 2341,
- "mean": 2341,
- "median": 2341,
- "max": 2341
- },
- "updateGuardian(address)": {
- "calls": 6,
- "min": 25944,
- "mean": 28245,
- "median": 28283,
- "max": 30394
- }
- }
- },
- {
- "contract": "test/PermissionlessRescuable.t.sol:TestPermissionlessRescuable",
- "deployment": { "gas": 879072, "size": 4033 },
- "functions": {
- "emergencyEtherTransfer(uint256)": {
- "calls": 2,
- "min": 59057,
- "mean": 59900,
- "median": 59900,
- "max": 60743
- },
- "emergencyTokenTransfer(address,uint256)": {
- "calls": 4,
- "min": 34213,
- "mean": 50627,
- "median": 51185,
- "max": 65925
- },
- "receive()": { "calls": 1, "min": 0, "mean": 0, "median": 0, "max": 0 },
- "whoShouldReceiveFunds()": {
- "calls": 1,
- "min": 2566,
- "mean": 2566,
- "median": 2566,
- "max": 2566
- }
- }
- }
-]
diff --git a/mocks/some.json b/mocks/some.json
new file mode 100644
index 0000000..c6f7879
--- /dev/null
+++ b/mocks/some.json
@@ -0,0 +1,11 @@
+{
+ "full amount; receiver: ->enableCollateral": "144837",
+ "full amount; sender: ->disableCollateral;": "103274",
+ "full amount; sender: ->disableCollateral; receiver: ->enableCollateral": "145016",
+ "full amount; sender: ->disableCollateral; receiver: dirty, ->enableCollateral": "133059",
+ "full amount; sender: collateralDisabled": "103095",
+ "partial amount; sender: collateralDisabled;": "103095",
+ "partial amount; sender: collateralDisabled; receiver: ->enableCollateral": "144837",
+ "partial amount; sender: collateralEnabled;": "103303",
+ "partial amount; sender: collateralEnabled; receiver: ->enableCollateral": "145045"
+}
\ No newline at end of file
diff --git a/mocks/someOther.json b/mocks/someOther.json
new file mode 100644
index 0000000..c6f7879
--- /dev/null
+++ b/mocks/someOther.json
@@ -0,0 +1,11 @@
+{
+ "full amount; receiver: ->enableCollateral": "144837",
+ "full amount; sender: ->disableCollateral;": "103274",
+ "full amount; sender: ->disableCollateral; receiver: ->enableCollateral": "145016",
+ "full amount; sender: ->disableCollateral; receiver: dirty, ->enableCollateral": "133059",
+ "full amount; sender: collateralDisabled": "103095",
+ "partial amount; sender: collateralDisabled;": "103095",
+ "partial amount; sender: collateralDisabled; receiver: ->enableCollateral": "144837",
+ "partial amount; sender: collateralEnabled;": "103303",
+ "partial amount; sender: collateralEnabled; receiver: ->enableCollateral": "145045"
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index a3ba559..4c8646b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"devDependencies": {
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
+ "@actions/glob": "^0.5.0",
"@types/node": "^22.9.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
@@ -48,6 +49,41 @@
"@octokit/plugin-rest-endpoint-methods": "^10.0.0"
}
},
+ "node_modules/@actions/glob": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
+ "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@actions/core": "^1.9.1",
+ "minimatch": "^3.0.4"
+ }
+ },
+ "node_modules/@actions/glob/node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/@actions/glob/node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/@actions/http-client": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
@@ -1196,6 +1232,13 @@
"node": ">= 6"
}
},
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/consola": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz",
diff --git a/package.json b/package.json
index 12f7b37..f074717 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"devDependencies": {
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
+ "@actions/glob": "^0.5.0",
"@types/node": "^22.9.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
@@ -52,4 +53,4 @@
"cjs"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/__snapshots__/lib.spec.ts.snap b/src/__snapshots__/lib.spec.ts.snap
deleted file mode 100644
index 1c5b40b..0000000
--- a/src/__snapshots__/lib.spec.ts.snap
+++ /dev/null
@@ -1,153 +0,0 @@
-// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-
-exports[`lib > should generate a well formatted report with empty root 1`] = `
-"### [Create3Factory](https://github.com/src/contracts/create3/Create3Factory.sol)
-
-- size: 1151 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-create(bytes32,bytes) | 286388 | 296666 | 287062 | 397068 | 6 |
-predictAddress(address,bytes32) | 1024 | 1024 | 1024 | 1025 | 6 |
-
-
-### [ProxyAdmin](https://github.com/src/contracts/transparent-proxy/ProxyAdmin.sol)
-
-- size: 0 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-owner() | 386 | 386 | 386 | 386 | 6 |
-
-
-### [TransparentProxyFactory](https://github.com/src/contracts/transparent-proxy/TransparentProxyFactory.sol)
-
-- size: 8244 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-createDeterministic(address,address,bytes,bytes32) | 574115 | 534507 | 574589 | 574703 | 6 |
-createDeterministicProxyAdmin(address,bytes32) | 421268 | 421658 | 421850 | 421856 | 6 |
-predictCreateDeterministic(address,address,bytes,bytes32) | 12057 | 12057 | 12057 | 12057 | 6 |
-predictCreateDeterministicProxyAdmin(bytes32) | 6236 | 6236 | 6236 | 6236 | 6 |
-
-
-### [TransparentUpgradeableProxy](https://github.com/src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol)
-
-- size: 0 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-getFoo() | 1042 | 1042 | 1042 | 1042 | 6 |
-
-
-### [ImplOwnableWithGuardian](https://github.com/test/OwnableWithGuardian.t.sol)
-
-- size: 1067 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-guardian() | 2286 | 2286 | 2286 | 2286 | 1 |
-owner() | 2341 | 2341 | 2341 | 2341 | 1 |
-updateGuardian(address) | 25944 | 28245 | 28283 | 30394 | 6 |
-
-
-### [TestPermissionlessRescuable](https://github.com/test/PermissionlessRescuable.t.sol)
-
-- size: 4033 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-emergencyEtherTransfer(uint256) | 59057 | 59900 | 59900 | 60743 | 2 |
-emergencyTokenTransfer(address,uint256) | 34213 | 50627 | 51185 | 65925 | 4 |
-receive() | 0 | 0 | 0 | 0 | 1 |
-whoShouldReceiveFunds() | 2566 | 2566 | 2566 | 2566 | 1 |
-
-
-"
-`;
-
-exports[`lib > should generate a well formatted report with existing root & skip unchanged 1`] = `
-"### [Create3Factory](https://github.com/src/contracts/create3/Create3Factory.sol)
-
-- size: 1151 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-create(bytes32,bytes) | ↓-3.4%286388 | 296666 | 287062 | ↑34%397068 | 6 |
-predictAddress(address,bytes32) | 1024 | 1024 | 1024 | 1025 | 6 |
-
-
-### [TransparentProxyFactory](https://github.com/src/contracts/transparent-proxy/TransparentProxyFactory.sol)
-
-- size: ↑14%8244 / 49152
-
-"
-`;
-
-exports[`lib > should generate a well formatted report with existing root 1`] = `
-"### [Create3Factory](https://github.com/src/contracts/create3/Create3Factory.sol)
-
-- size: 1151 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-create(bytes32,bytes) | ↓-3.4%286388 | 296666 | 287062 | ↑34%397068 | 6 |
-predictAddress(address,bytes32) | 1024 | 1024 | 1024 | 1025 | 6 |
-
-
-### [ProxyAdmin](https://github.com/src/contracts/transparent-proxy/ProxyAdmin.sol)
-
-- size: 0 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-owner() | 386 | 386 | 386 | 386 | 6 |
-
-
-### [TransparentProxyFactory](https://github.com/src/contracts/transparent-proxy/TransparentProxyFactory.sol)
-
-- size: ↑14%8244 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-createDeterministic(address,address,bytes,bytes32) | 574115 | 534507 | 574589 | 574703 | 6 |
-createDeterministicProxyAdmin(address,bytes32) | 421268 | 421658 | 421850 | 421856 | 6 |
-predictCreateDeterministic(address,address,bytes,bytes32) | 12057 | 12057 | 12057 | 12057 | 6 |
-predictCreateDeterministicProxyAdmin(bytes32) | 6236 | 6236 | 6236 | 6236 | 6 |
-
-
-### [TransparentUpgradeableProxy](https://github.com/src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol)
-
-- size: 0 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-getFoo() | 1042 | 1042 | 1042 | 1042 | 6 |
-
-
-### [ImplOwnableWithGuardian](https://github.com/test/OwnableWithGuardian.t.sol)
-
-- size: 1067 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-guardian() | 2286 | 2286 | 2286 | 2286 | 1 |
-owner() | 2341 | 2341 | 2341 | 2341 | 1 |
-updateGuardian(address) | 25944 | 28245 | 28283 | 30394 | 6 |
-
-
-### [TestPermissionlessRescuable](https://github.com/test/PermissionlessRescuable.t.sol)
-
-- size: 4033 / 49152
-
-| Method | min | mean | median | max | calls |
-| --- | ---: | ---: | ---: | ---: | ---: |
-emergencyEtherTransfer(uint256) | 59057 | 59900 | 59900 | 60743 | 2 |
-emergencyTokenTransfer(address,uint256) | 34213 | 50627 | 51185 | 65925 | 4 |
-receive() | 0 | 0 | 0 | 0 | 1 |
-whoShouldReceiveFunds() | 2566 | 2566 | 2566 | 2566 | 1 |
-
-
-"
-`;
diff --git a/src/action.ts b/src/action.ts
index 9810006..b2bf1b6 100644
--- a/src/action.ts
+++ b/src/action.ts
@@ -1,25 +1,53 @@
-import { readFileSync, existsSync } from "fs";
-import { getInput, setOutput } from "@actions/core";
-import { context } from "@actions/github";
-import { getHtmlGasReport } from "./lib";
+import { readFile } from "node:fs/promises";
+import { debug, getInput, setOutput } from "@actions/core";
+import { context, getOctokit } from "@actions/github";
+import glob from "@actions/glob";
+import { formatDiffMd, snapshotDiff } from "./lib";
-const root = getInput("ROOT_REPORT_PATH");
-const current = getInput("REPORT_PATH");
+const baseBranch = getInput("baseBranch");
+const octokit = getOctokit(getInput("token"));
+debug(`Base branch: ${baseBranch}`);
-const rootExists = root && existsSync(root);
-const currentExists = current && existsSync(current);
+const getBaseFile = async (path: string) => {
+ const { data } = await octokit.rest.repos.getContent({
+ repo: context.repo.repo,
+ owner: context.repo.owner,
+ path,
+ ref: baseBranch,
+ });
-if (!currentExists) throw new Error("gas report not found");
+ if (!data || !("content" in data)) {
+ return {};
+ }
-const rootContent = rootExists ? JSON.parse(readFileSync(root, "utf8")) : [];
-const currentContent = JSON.parse(readFileSync(current, "utf8"));
+ return JSON.parse(data.content);
+};
-const table = getHtmlGasReport(rootContent, currentContent, {
- rootUrl: `${context.payload.repository?.html_url}/blob/${context.sha}/`,
- ignoreUnchanged: getInput("ignoreUnchanged") === "true",
-});
-setOutput(
- "report",
- `:fuelpump: Gas report
\n\n${table}\n\n `,
-);
+(async () => {
+ const results: Parameters[0] = [];
+
+ const globber = await glob.create(getInput("files"));
+ const files = await globber.glob();
+ debug(`Files to compare: ${files.join(", ")}`);
+
+ for (const path of files) {
+ debug(`Comparing ${path}`);
+ const before = await getBaseFile(path);
+ const after = JSON.parse(await readFile(path, "utf8"));
+ const diff = snapshotDiff({
+ before,
+ after,
+ });
+ results.push({
+ path,
+ diff,
+ });
+ }
+
+ debug(`Results: ${JSON.stringify(results)}`);
+ const report = formatDiffMd(results);
+ debug(`Report: ${report}`);
+
+ setOutput("report", report);
+})
\ No newline at end of file
diff --git a/src/lib.spec.ts b/src/lib.spec.ts
index e2c6a74..bcb4143 100644
--- a/src/lib.spec.ts
+++ b/src/lib.spec.ts
@@ -1,29 +1,107 @@
import { expect, it, describe } from "vitest";
-import { getHtmlGasReport } from "./lib";
-import gas from "../mocks/gas.json";
-import gasRoot from "../mocks/gas.backup.json";
+import { formatDiffMd, snapshotDiff } from "./lib";
+
+const before = {
+ "test_removed": "123",
+ "test_unchanged": "456",
+ "test_bigger": "789",
+ "test_smaller": "789",
+}
+
+const after = {
+ "test_unchanged": "456",
+ "test_bigger": "1111",
+ "test_smaller": "654",
+ "test_added": "789",
+}
describe("lib", () => {
- it("should generate a well formatted report with empty root", () => {
- expect(
- getHtmlGasReport([], gas as any, {
- rootUrl: "https://github.com/",
- }),
- ).toMatchSnapshot();
- });
- it("should generate a well formatted report with existing root", () => {
- expect(
- getHtmlGasReport(gasRoot as any, gas as any, {
- rootUrl: "https://github.com/",
- }),
- ).toMatchSnapshot();
- });
- it("should generate a well formatted report with existing root & skip unchanged", () => {
+ it("should throw when not passed numbers in before", () => {
+ expect(() => snapshotDiff({
+ before: {
+ "test": "abc",
+ },
+ after: {
+ "test": "123",
+ },
+ })).toThrowErrorMatchingInlineSnapshot(`[Error: The following keys in before are not numbers: test]`);
+ })
+
+ it("should throw when not passed numbers in after", () => {
+ expect(() => snapshotDiff({
+ before: {
+ "test": "123",
+ },
+ after: {
+ "test": "abc",
+ },
+ })).toThrowErrorMatchingInlineSnapshot(`[Error: The following keys in after are not numbers: test]`);
+ })
+
+ it("should detect differences between two different snapshots", () => {
+
+
expect(
- getHtmlGasReport(gasRoot as any, gas as any, {
- rootUrl: "https://github.com/",
- ignoreUnchanged: true,
+ snapshotDiff({
+ before,
+ after
}),
- ).toMatchSnapshot();
+ ).toMatchInlineSnapshot(`
+ {
+ "added": {
+ "test_added": "789",
+ },
+ "changed": {
+ "test_bigger": "↑41% (+322) 1,111",
+ "test_smaller": "↓17% (-135) 654",
+ },
+ "removed": {
+ "test_removed": "123",
+ },
+ "unchanged": {
+ "test_unchanged": "456",
+ },
+ }
+ `);
});
+
+ it("nicely formats the diff as markdown", () => {
+ const diffA = snapshotDiff({
+ before,
+ after
+ })
+
+ const diffB = snapshotDiff({
+ before,
+ after
+ })
+
+ const result = formatDiffMd([{ path: "path_a", diff: diffA }, { path: "path_b", diff: diffB }])
+ console.log(result)
+ expect(result).toMatchInlineSnapshot(`
+ "### ♻️ Changed
+ | Path | Value |
+ | --- | --- |
+ | **path_a** | |
+ | test_bigger | ↑41% (+322) 1,111 |
+ | test_smaller | ↓17% (-135) 654 |
+ | test_removed | 123 |
+ | test_added | 789 |
+ | **path_b** | |
+ | test_bigger | ↑41% (+322) 1,111 |
+ | test_smaller | ↓17% (-135) 654 |
+ | test_removed | 123 |
+ | test_added | 789 |
+
+ 🔕 Unchanged
+
+ | Path | Value |
+ | --- | --- |
+ | **path_a** | |
+ | test_unchanged | 456 |
+ | **path_b** | |
+ | test_unchanged | 456 |
+ "
+ `)
+ })
});
diff --git a/src/lib.ts b/src/lib.ts
index 0d60f82..c93256a 100644
--- a/src/lib.ts
+++ b/src/lib.ts
@@ -1,107 +1,117 @@
-type FunctionSnapshot = {
- calls: number;
- min: number;
- mean: number;
- median: number;
- max: number;
-};
+type Snapshot = Record;
-type GasSnapshot = {
- contract: string;
- deployment: { gas: number; size: number };
- functions: Record;
-}[];
+const numberFormat = new Intl.NumberFormat("en-US");
-type Options = {
- rootUrl?: string;
- ignoreUnchanged?: boolean;
+const formatNumber = (value: string) => {
+ return numberFormat.format(Number(value));
};
-const UP = `↑`;
-const DOWN = `↓`;
-
-function findContract(
- contract: string,
- snapshot: {
- contract: string;
- deployment: { gas: number; size: number };
- functions: Record<
- string,
- { calls: number; min: number; mean: number; median: number; max: number }
- >;
- }[],
-) {
- return snapshot.find((item) => item.contract === contract);
-}
+export function snapshotDiff({
+ before,
+ after,
+}: {
+ before: Snapshot;
+ after: Snapshot;
+}) {
+ const removed: Snapshot = {};
+ const added: Snapshot = {};
+ const changed: Snapshot = {};
+ const unchanged: Snapshot = {};
-function findFunction(
- fn: string,
- snapshot: Record<
- string,
- { calls: number; min: number; mean: number; median: number; max: number }
- >,
-) {
- return snapshot[fn];
-}
+ const beforeKeys = Object.keys(before);
+ const afterKeys = Object.keys(after);
-function formatValue(before: number | undefined, after: number) {
- if (!before || after === before) return after;
- const diff = ((after - before) / Math.abs(before)) * 100;
- // if diff is below threshold, showing the diff is more noise than signal
- if (Math.abs(diff) < 0.1) return after;
- return `${diff > 0 ? UP : DOWN}${new Intl.NumberFormat(
- "en-US",
- {
- maximumSignificantDigits: 2,
- },
- ).format(diff)}%${after}`;
-}
+ const beforeNotNumbers = beforeKeys.filter((key) =>
+ Number.isNaN(Number(before[key])),
+ );
+ const afterNotNumbers = afterKeys.filter((key) =>
+ Number.isNaN(Number(after[key])),
+ );
+
+ if (beforeNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in before are not numbers: ${beforeNotNumbers.join(", ")}`,
+ );
+ }
+
+ if (afterNotNumbers.length > 0) {
+ throw new Error(
+ `The following keys in after are not numbers: ${afterNotNumbers.join(", ")}`,
+ );
+ }
+
+ for (const _key of beforeKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+
+ if (!after_value) {
+ removed[key] = formatNumber(before_value);
+ } else if (before_value !== after_value) {
+ const diff = Math.abs(Number(before_value) - Number(after_value));
+ const diffPercentage = Math.round((diff / Number(before_value)) * 100);
+ const diffSym = Number(before_value) < Number(after_value) ? "↑" : "↓";
+ const diffSign = Number(before_value) < Number(after_value) ? "+" : "-";
+ changed[key] =
+ `${diffSym}${diffPercentage}% (${diffSign}${diff}) ${formatNumber(after_value)}`;
+ } else {
+ unchanged[key] = formatNumber(before_value);
+ }
+ }
-export function getHtmlGasReport(
- before: GasSnapshot,
- after: GasSnapshot,
- options: Options = {},
-) {
- // report accumulator
- let content = "";
- after.map((item) => {
- const contractBefore = findContract(item.contract, before);
- if (
- options.ignoreUnchanged &&
- contractBefore &&
- JSON.stringify(item) === JSON.stringify(contractBefore)
- )
- return;
- const [path, name] = item.contract.split(":");
- content += `### [${name}](${options.rootUrl}${path})\n\n`;
- // limit 49152
- content += `- size: ${formatValue(contractBefore?.deployment.size, item.deployment.size)} / 49152\n\n`;
- // Commented out because it's not used atm.
- // Not exactly sure if "gas" is helpful for anything.
- // content += `- gas: ${formatValue(contractBefore?.deployment.gas, item.deployment.gas)}\n\n`
- if (
- options.ignoreUnchanged &&
- contractBefore &&
- JSON.stringify(item.functions) ===
- JSON.stringify(contractBefore.functions)
- )
- return;
- else {
- let rows = `| Method | min | mean | median | max | calls |\n| --- | ---: | ---: | ---: | ---: | ---: |\n`;
- Object.entries(item.functions).map(([method, values]) => {
- const before =
- contractBefore && findFunction(method, contractBefore.functions);
- if (
- options.ignoreUnchanged &&
- before &&
- JSON.stringify(before) === JSON.stringify(values)
- )
- return;
- rows += `${method} | ${formatValue(before?.min, values.min)} | ${formatValue(before?.mean, values.mean)} | ${formatValue(before?.median, values.median)} | ${formatValue(before?.max, values.max)} | ${formatValue(before?.calls, values.calls)} |\n`;
- });
- content += rows;
+ for (const _key of afterKeys) {
+ const key = _key;
+ const before_value = before[_key];
+ const after_value = after[_key];
+
+ if (!before_value) {
+ added[key] = after_value;
}
- content += "\n\n";
- });
- return content;
+ }
+
+ return {
+ removed,
+ added,
+ changed,
+ unchanged,
+ };
}
+
+export const formatDiffMd = (
+ input: { path: string; diff: ReturnType }[],
+) => {
+ const th = "| Path | Value |";
+ const hr = "| --- | ---: |";
+ const br = "";
+ const changedLines: string[] = ["### ♻️ Changed", th, hr];
+ const unchangedLines: string[] = [
+ br,
+ "🔕 Unchanged
",
+ br,
+ th,
+ hr,
+ ];
+
+ const formatLine = (key: string, value: string) => `| ${key} | ${value} |`;
+ const formatGroup = (values: [string, string][]) => {
+ return values.map(([key, value]) => formatLine(`${key}`, `${value}`));
+ };
+
+ for (const { path, diff } of input) {
+ changedLines.push(formatLine(`**${path}**`, ""));
+ const changed = diff.changed;
+ const added = diff.added;
+ const removed = diff.removed;
+ const unchanged = diff.unchanged;
+
+ changedLines.push(...formatGroup(Object.entries(changed)));
+ changedLines.push(...formatGroup(Object.entries(removed)));
+ changedLines.push(...formatGroup(Object.entries(added)));
+
+ unchangedLines.push(formatLine(`**${path}**`, ""));
+ unchangedLines.push(...formatGroup(Object.entries(unchanged)));
+ }
+ unchangedLines.push(" ");
+
+ return [...changedLines, ...unchangedLines].join("\n");
+};