UNPKG

@dapplion/benchmark

Version:

Ensures that new code does not introduce performance regressions with CI. Tracks:

34 lines (33 loc) 1.2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGithubEventData = getGithubEventData; const node_fs_1 = __importDefault(require("node:fs")); /** * Github actions store the event data payload at a JSON file with path * process.env.GITHUB_EVENT_PATH * * For example: '/home/runner/work/_temp/_github_workflow/event.json' * * The contents of the file are event dependant and equal to this docs * https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#webhook-payload-object-5 * * For example (on delete): * * { * "pusher_type": "user", * "ref": "dapplion/branch-to-delete", * "ref_type": "branch", * "repository": { ... }, * "organization": { ... }, * "sender": { ... } * } */ function getGithubEventData() { if (!process.env.GITHUB_EVENT_PATH) { throw Error("Not in a Github Actions context, no GITHUB_EVENT_PATH"); } return JSON.parse(node_fs_1.default.readFileSync(process.env.GITHUB_EVENT_PATH, "utf8")); }