UNPKG

tdpw

Version:

CLI tool for uploading Playwright test reports to TestDino platform with Azure storage support

57 lines 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CiCollector = void 0; const tslib_1 = require("tslib"); const os_1 = tslib_1.__importDefault(require("os")); const env_1 = require("../utils/env"); /** * Collector for CI metadata */ class CiCollector { /** * Gather CI metadata from environment */ static collect() { const { env } = process; const providerKey = env_1.EnvironmentUtils.detectCIProvider(); const provider = providerKey || 'unknown'; // Pipeline information const pipelineId = env.GITHUB_RUN_ID || env.CI_PIPELINE_ID || 'unknown'; const pipelineName = env.GITHUB_WORKFLOW || env.CI_PIPELINE_NAME || 'CI Pipeline'; let pipelineUrl = ''; if (env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY && env.GITHUB_RUN_ID) { pipelineUrl = `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`; } else if (env.CI_PIPELINE_URL) { pipelineUrl = env.CI_PIPELINE_URL; } // Build information const buildNumber = env.GITHUB_RUN_NUMBER || env.CI_BUILD_NUMBER || 'unknown'; const buildTrigger = env.GITHUB_EVENT_NAME || env.CI_PIPELINE_TRIGGER || ''; // Environment details const environmentName = env.RUNNER_OS || 'local'; const environmentType = os_1.default.platform() || ''; const osRelease = `${os_1.default.type()} ${os_1.default.release()}`; const nodeVersion = process.version || 'unknown'; return { provider, pipeline: { id: pipelineId, name: pipelineName, url: pipelineUrl, }, build: { number: buildNumber, trigger: buildTrigger, }, environment: { name: environmentName, type: environmentType, os: osRelease, node: nodeVersion, }, }; } } exports.CiCollector = CiCollector; //# sourceMappingURL=ci.js.map