@postman-cse/onboarding-repo-sync 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.cjs +89 -4
- package/dist/cli.cjs +89 -4
- package/dist/index.cjs +89 -4
- package/package.json +2 -2
package/dist/action.cjs
CHANGED
|
@@ -24280,7 +24280,65 @@ function norm(value) {
|
|
|
24280
24280
|
const trimmed = (value ?? "").trim();
|
|
24281
24281
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
24282
24282
|
}
|
|
24283
|
+
function detectEventTrigger(env = process.env) {
|
|
24284
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
24285
|
+
if (ghEvent) {
|
|
24286
|
+
if (ghEvent === "push")
|
|
24287
|
+
return "push";
|
|
24288
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
24289
|
+
return "pull_request";
|
|
24290
|
+
if (ghEvent === "schedule")
|
|
24291
|
+
return "schedule";
|
|
24292
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
24293
|
+
return "manual";
|
|
24294
|
+
return "other";
|
|
24295
|
+
}
|
|
24296
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
24297
|
+
if (glSource) {
|
|
24298
|
+
if (glSource === "push")
|
|
24299
|
+
return "push";
|
|
24300
|
+
if (glSource === "merge_request_event")
|
|
24301
|
+
return "pull_request";
|
|
24302
|
+
if (glSource === "schedule")
|
|
24303
|
+
return "schedule";
|
|
24304
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
24305
|
+
return "manual";
|
|
24306
|
+
}
|
|
24307
|
+
return "other";
|
|
24308
|
+
}
|
|
24309
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
24310
|
+
return "pull_request";
|
|
24311
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
24312
|
+
return "other";
|
|
24313
|
+
}
|
|
24314
|
+
return "unknown";
|
|
24315
|
+
}
|
|
24316
|
+
function detectRunnerOs(env = process.env) {
|
|
24317
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
24318
|
+
if (runnerOs === "linux")
|
|
24319
|
+
return "linux";
|
|
24320
|
+
if (runnerOs === "macos")
|
|
24321
|
+
return "macos";
|
|
24322
|
+
if (runnerOs === "windows")
|
|
24323
|
+
return "windows";
|
|
24324
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
24325
|
+
if (platform2 === "linux")
|
|
24326
|
+
return "linux";
|
|
24327
|
+
if (platform2 === "darwin")
|
|
24328
|
+
return "macos";
|
|
24329
|
+
if (platform2 === "win32")
|
|
24330
|
+
return "windows";
|
|
24331
|
+
return "unknown";
|
|
24332
|
+
}
|
|
24283
24333
|
function detectCiContext(env = process.env) {
|
|
24334
|
+
const provider = detectCiProviderContext(env);
|
|
24335
|
+
return {
|
|
24336
|
+
...provider,
|
|
24337
|
+
eventTrigger: detectEventTrigger(env),
|
|
24338
|
+
runnerOs: detectRunnerOs(env)
|
|
24339
|
+
};
|
|
24340
|
+
}
|
|
24341
|
+
function detectCiProviderContext(env = process.env) {
|
|
24284
24342
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
24285
24343
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
24286
24344
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -24418,25 +24476,49 @@ function parseProvider2(explicitProvider, repoUrl, env) {
|
|
|
24418
24476
|
}
|
|
24419
24477
|
return "unknown";
|
|
24420
24478
|
}
|
|
24479
|
+
function classifyRefKind(env = process.env) {
|
|
24480
|
+
const githubRefType = normalize2(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
24481
|
+
const githubRef = normalize2(env.GITHUB_REF);
|
|
24482
|
+
const azureRef = normalize2(env.BUILD_SOURCEBRANCH);
|
|
24483
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize2(env.CI_COMMIT_TAG) || normalize2(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
24484
|
+
return "tag";
|
|
24485
|
+
}
|
|
24486
|
+
const githubRefName = normalize2(env.GITHUB_REF_NAME);
|
|
24487
|
+
const githubDefault = normalize2(env.GITHUB_DEFAULT_BRANCH);
|
|
24488
|
+
if (githubRefName && githubDefault) {
|
|
24489
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
24490
|
+
}
|
|
24491
|
+
const gitlabRef = normalize2(env.CI_COMMIT_REF_NAME);
|
|
24492
|
+
const gitlabDefault = normalize2(env.CI_DEFAULT_BRANCH);
|
|
24493
|
+
if (gitlabRef && gitlabDefault) {
|
|
24494
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
24495
|
+
}
|
|
24496
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize2(env.BITBUCKET_BRANCH) || normalize2(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
24497
|
+
return "branch";
|
|
24498
|
+
}
|
|
24499
|
+
return "unknown";
|
|
24500
|
+
}
|
|
24421
24501
|
function detectRepoContext2(input, env = process.env) {
|
|
24422
24502
|
const repoUrl = normalizeRepoUrl2(input.repoUrl) ?? normalizeRepoUrl2(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl2(env.CI_PROJECT_URL) ?? normalizeRepoUrl2(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl2(env.BUILD_REPOSITORY_URI);
|
|
24423
24503
|
const repoSlug = normalize2(input.repoSlug) ?? normalize2(env.GITHUB_REPOSITORY) ?? normalize2(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize2(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize2(env.BUILD_REPOSITORY_NAME);
|
|
24424
24504
|
const ref = normalize2(input.ref) ?? normalize2(env.GITHUB_REF_NAME) ?? normalize2(env.CI_COMMIT_REF_NAME) ?? normalize2(env.BITBUCKET_BRANCH) ?? normalize2(env.BUILD_SOURCEBRANCHNAME);
|
|
24425
24505
|
const sha = normalize2(input.sha) ?? normalize2(env.GITHUB_SHA) ?? normalize2(env.CI_COMMIT_SHA) ?? normalize2(env.BITBUCKET_COMMIT) ?? normalize2(env.BUILD_SOURCEVERSION);
|
|
24426
24506
|
const provider = parseProvider2(input.gitProvider, repoUrl, env);
|
|
24507
|
+
const refKind = classifyRefKind(env);
|
|
24427
24508
|
return {
|
|
24428
24509
|
provider,
|
|
24429
24510
|
repoUrl,
|
|
24430
24511
|
repoSlug,
|
|
24431
24512
|
ref,
|
|
24432
|
-
sha
|
|
24513
|
+
sha,
|
|
24514
|
+
refKind
|
|
24433
24515
|
};
|
|
24434
24516
|
}
|
|
24435
24517
|
|
|
24436
24518
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
24437
24519
|
var import_node_crypto = require("node:crypto");
|
|
24438
24520
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
24439
|
-
var SCHEMA_VERSION =
|
|
24521
|
+
var SCHEMA_VERSION = 3;
|
|
24440
24522
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
24441
24523
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
24442
24524
|
var proxyDispatcher;
|
|
@@ -24447,7 +24529,7 @@ function resolveActionVersion(explicit) {
|
|
|
24447
24529
|
if (explicit) {
|
|
24448
24530
|
return explicit;
|
|
24449
24531
|
}
|
|
24450
|
-
return "1.0.
|
|
24532
|
+
return "1.0.5" ? "1.0.5" : "unknown";
|
|
24451
24533
|
}
|
|
24452
24534
|
function telemetryDisabled(env) {
|
|
24453
24535
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -24476,7 +24558,7 @@ function maybeNotice(logger) {
|
|
|
24476
24558
|
return;
|
|
24477
24559
|
}
|
|
24478
24560
|
noticeShown = true;
|
|
24479
|
-
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
24561
|
+
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type, run trigger, runner OS). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
24480
24562
|
}
|
|
24481
24563
|
function buildTelemetryEvent(params) {
|
|
24482
24564
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -24498,6 +24580,9 @@ function buildTelemetryEvent(params) {
|
|
|
24498
24580
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
24499
24581
|
org_id: owner ? sha256(owner) : void 0,
|
|
24500
24582
|
account_type: accountType,
|
|
24583
|
+
event_trigger: ci.eventTrigger,
|
|
24584
|
+
runner_os: ci.runnerOs,
|
|
24585
|
+
ref_kind: repo.refKind,
|
|
24501
24586
|
outcome,
|
|
24502
24587
|
ts: now()
|
|
24503
24588
|
};
|
package/dist/cli.cjs
CHANGED
|
@@ -22383,7 +22383,65 @@ function norm(value) {
|
|
|
22383
22383
|
const trimmed = (value ?? "").trim();
|
|
22384
22384
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
22385
22385
|
}
|
|
22386
|
+
function detectEventTrigger(env = process.env) {
|
|
22387
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
22388
|
+
if (ghEvent) {
|
|
22389
|
+
if (ghEvent === "push")
|
|
22390
|
+
return "push";
|
|
22391
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
22392
|
+
return "pull_request";
|
|
22393
|
+
if (ghEvent === "schedule")
|
|
22394
|
+
return "schedule";
|
|
22395
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
22396
|
+
return "manual";
|
|
22397
|
+
return "other";
|
|
22398
|
+
}
|
|
22399
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
22400
|
+
if (glSource) {
|
|
22401
|
+
if (glSource === "push")
|
|
22402
|
+
return "push";
|
|
22403
|
+
if (glSource === "merge_request_event")
|
|
22404
|
+
return "pull_request";
|
|
22405
|
+
if (glSource === "schedule")
|
|
22406
|
+
return "schedule";
|
|
22407
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
22408
|
+
return "manual";
|
|
22409
|
+
}
|
|
22410
|
+
return "other";
|
|
22411
|
+
}
|
|
22412
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
22413
|
+
return "pull_request";
|
|
22414
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
22415
|
+
return "other";
|
|
22416
|
+
}
|
|
22417
|
+
return "unknown";
|
|
22418
|
+
}
|
|
22419
|
+
function detectRunnerOs(env = process.env) {
|
|
22420
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
22421
|
+
if (runnerOs === "linux")
|
|
22422
|
+
return "linux";
|
|
22423
|
+
if (runnerOs === "macos")
|
|
22424
|
+
return "macos";
|
|
22425
|
+
if (runnerOs === "windows")
|
|
22426
|
+
return "windows";
|
|
22427
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
22428
|
+
if (platform2 === "linux")
|
|
22429
|
+
return "linux";
|
|
22430
|
+
if (platform2 === "darwin")
|
|
22431
|
+
return "macos";
|
|
22432
|
+
if (platform2 === "win32")
|
|
22433
|
+
return "windows";
|
|
22434
|
+
return "unknown";
|
|
22435
|
+
}
|
|
22386
22436
|
function detectCiContext(env = process.env) {
|
|
22437
|
+
const provider = detectCiProviderContext(env);
|
|
22438
|
+
return {
|
|
22439
|
+
...provider,
|
|
22440
|
+
eventTrigger: detectEventTrigger(env),
|
|
22441
|
+
runnerOs: detectRunnerOs(env)
|
|
22442
|
+
};
|
|
22443
|
+
}
|
|
22444
|
+
function detectCiProviderContext(env = process.env) {
|
|
22387
22445
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
22388
22446
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
22389
22447
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -22521,25 +22579,49 @@ function parseProvider2(explicitProvider, repoUrl, env) {
|
|
|
22521
22579
|
}
|
|
22522
22580
|
return "unknown";
|
|
22523
22581
|
}
|
|
22582
|
+
function classifyRefKind(env = process.env) {
|
|
22583
|
+
const githubRefType = normalize2(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
22584
|
+
const githubRef = normalize2(env.GITHUB_REF);
|
|
22585
|
+
const azureRef = normalize2(env.BUILD_SOURCEBRANCH);
|
|
22586
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize2(env.CI_COMMIT_TAG) || normalize2(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
22587
|
+
return "tag";
|
|
22588
|
+
}
|
|
22589
|
+
const githubRefName = normalize2(env.GITHUB_REF_NAME);
|
|
22590
|
+
const githubDefault = normalize2(env.GITHUB_DEFAULT_BRANCH);
|
|
22591
|
+
if (githubRefName && githubDefault) {
|
|
22592
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
22593
|
+
}
|
|
22594
|
+
const gitlabRef = normalize2(env.CI_COMMIT_REF_NAME);
|
|
22595
|
+
const gitlabDefault = normalize2(env.CI_DEFAULT_BRANCH);
|
|
22596
|
+
if (gitlabRef && gitlabDefault) {
|
|
22597
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
22598
|
+
}
|
|
22599
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize2(env.BITBUCKET_BRANCH) || normalize2(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
22600
|
+
return "branch";
|
|
22601
|
+
}
|
|
22602
|
+
return "unknown";
|
|
22603
|
+
}
|
|
22524
22604
|
function detectRepoContext2(input, env = process.env) {
|
|
22525
22605
|
const repoUrl = normalizeRepoUrl2(input.repoUrl) ?? normalizeRepoUrl2(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl2(env.CI_PROJECT_URL) ?? normalizeRepoUrl2(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl2(env.BUILD_REPOSITORY_URI);
|
|
22526
22606
|
const repoSlug = normalize2(input.repoSlug) ?? normalize2(env.GITHUB_REPOSITORY) ?? normalize2(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize2(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize2(env.BUILD_REPOSITORY_NAME);
|
|
22527
22607
|
const ref = normalize2(input.ref) ?? normalize2(env.GITHUB_REF_NAME) ?? normalize2(env.CI_COMMIT_REF_NAME) ?? normalize2(env.BITBUCKET_BRANCH) ?? normalize2(env.BUILD_SOURCEBRANCHNAME);
|
|
22528
22608
|
const sha = normalize2(input.sha) ?? normalize2(env.GITHUB_SHA) ?? normalize2(env.CI_COMMIT_SHA) ?? normalize2(env.BITBUCKET_COMMIT) ?? normalize2(env.BUILD_SOURCEVERSION);
|
|
22529
22609
|
const provider = parseProvider2(input.gitProvider, repoUrl, env);
|
|
22610
|
+
const refKind = classifyRefKind(env);
|
|
22530
22611
|
return {
|
|
22531
22612
|
provider,
|
|
22532
22613
|
repoUrl,
|
|
22533
22614
|
repoSlug,
|
|
22534
22615
|
ref,
|
|
22535
|
-
sha
|
|
22616
|
+
sha,
|
|
22617
|
+
refKind
|
|
22536
22618
|
};
|
|
22537
22619
|
}
|
|
22538
22620
|
|
|
22539
22621
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
22540
22622
|
var import_node_crypto = require("node:crypto");
|
|
22541
22623
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
22542
|
-
var SCHEMA_VERSION =
|
|
22624
|
+
var SCHEMA_VERSION = 3;
|
|
22543
22625
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
22544
22626
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
22545
22627
|
var proxyDispatcher;
|
|
@@ -22550,7 +22632,7 @@ function resolveActionVersion(explicit) {
|
|
|
22550
22632
|
if (explicit) {
|
|
22551
22633
|
return explicit;
|
|
22552
22634
|
}
|
|
22553
|
-
return "1.0.
|
|
22635
|
+
return "1.0.5" ? "1.0.5" : "unknown";
|
|
22554
22636
|
}
|
|
22555
22637
|
function telemetryDisabled(env) {
|
|
22556
22638
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -22579,7 +22661,7 @@ function maybeNotice(logger) {
|
|
|
22579
22661
|
return;
|
|
22580
22662
|
}
|
|
22581
22663
|
noticeShown = true;
|
|
22582
|
-
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
22664
|
+
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type, run trigger, runner OS). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
22583
22665
|
}
|
|
22584
22666
|
function buildTelemetryEvent(params) {
|
|
22585
22667
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -22601,6 +22683,9 @@ function buildTelemetryEvent(params) {
|
|
|
22601
22683
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
22602
22684
|
org_id: owner ? sha256(owner) : void 0,
|
|
22603
22685
|
account_type: accountType,
|
|
22686
|
+
event_trigger: ci.eventTrigger,
|
|
22687
|
+
runner_os: ci.runnerOs,
|
|
22688
|
+
ref_kind: repo.refKind,
|
|
22604
22689
|
outcome,
|
|
22605
22690
|
ts: now()
|
|
22606
22691
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -24295,7 +24295,65 @@ function norm(value) {
|
|
|
24295
24295
|
const trimmed = (value ?? "").trim();
|
|
24296
24296
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
24297
24297
|
}
|
|
24298
|
+
function detectEventTrigger(env = process.env) {
|
|
24299
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
24300
|
+
if (ghEvent) {
|
|
24301
|
+
if (ghEvent === "push")
|
|
24302
|
+
return "push";
|
|
24303
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
24304
|
+
return "pull_request";
|
|
24305
|
+
if (ghEvent === "schedule")
|
|
24306
|
+
return "schedule";
|
|
24307
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
24308
|
+
return "manual";
|
|
24309
|
+
return "other";
|
|
24310
|
+
}
|
|
24311
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
24312
|
+
if (glSource) {
|
|
24313
|
+
if (glSource === "push")
|
|
24314
|
+
return "push";
|
|
24315
|
+
if (glSource === "merge_request_event")
|
|
24316
|
+
return "pull_request";
|
|
24317
|
+
if (glSource === "schedule")
|
|
24318
|
+
return "schedule";
|
|
24319
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
24320
|
+
return "manual";
|
|
24321
|
+
}
|
|
24322
|
+
return "other";
|
|
24323
|
+
}
|
|
24324
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
24325
|
+
return "pull_request";
|
|
24326
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
24327
|
+
return "other";
|
|
24328
|
+
}
|
|
24329
|
+
return "unknown";
|
|
24330
|
+
}
|
|
24331
|
+
function detectRunnerOs(env = process.env) {
|
|
24332
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
24333
|
+
if (runnerOs === "linux")
|
|
24334
|
+
return "linux";
|
|
24335
|
+
if (runnerOs === "macos")
|
|
24336
|
+
return "macos";
|
|
24337
|
+
if (runnerOs === "windows")
|
|
24338
|
+
return "windows";
|
|
24339
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
24340
|
+
if (platform2 === "linux")
|
|
24341
|
+
return "linux";
|
|
24342
|
+
if (platform2 === "darwin")
|
|
24343
|
+
return "macos";
|
|
24344
|
+
if (platform2 === "win32")
|
|
24345
|
+
return "windows";
|
|
24346
|
+
return "unknown";
|
|
24347
|
+
}
|
|
24298
24348
|
function detectCiContext(env = process.env) {
|
|
24349
|
+
const provider = detectCiProviderContext(env);
|
|
24350
|
+
return {
|
|
24351
|
+
...provider,
|
|
24352
|
+
eventTrigger: detectEventTrigger(env),
|
|
24353
|
+
runnerOs: detectRunnerOs(env)
|
|
24354
|
+
};
|
|
24355
|
+
}
|
|
24356
|
+
function detectCiProviderContext(env = process.env) {
|
|
24299
24357
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
24300
24358
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
24301
24359
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -24433,25 +24491,49 @@ function parseProvider2(explicitProvider, repoUrl, env) {
|
|
|
24433
24491
|
}
|
|
24434
24492
|
return "unknown";
|
|
24435
24493
|
}
|
|
24494
|
+
function classifyRefKind(env = process.env) {
|
|
24495
|
+
const githubRefType = normalize2(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
24496
|
+
const githubRef = normalize2(env.GITHUB_REF);
|
|
24497
|
+
const azureRef = normalize2(env.BUILD_SOURCEBRANCH);
|
|
24498
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize2(env.CI_COMMIT_TAG) || normalize2(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
24499
|
+
return "tag";
|
|
24500
|
+
}
|
|
24501
|
+
const githubRefName = normalize2(env.GITHUB_REF_NAME);
|
|
24502
|
+
const githubDefault = normalize2(env.GITHUB_DEFAULT_BRANCH);
|
|
24503
|
+
if (githubRefName && githubDefault) {
|
|
24504
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
24505
|
+
}
|
|
24506
|
+
const gitlabRef = normalize2(env.CI_COMMIT_REF_NAME);
|
|
24507
|
+
const gitlabDefault = normalize2(env.CI_DEFAULT_BRANCH);
|
|
24508
|
+
if (gitlabRef && gitlabDefault) {
|
|
24509
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
24510
|
+
}
|
|
24511
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize2(env.BITBUCKET_BRANCH) || normalize2(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
24512
|
+
return "branch";
|
|
24513
|
+
}
|
|
24514
|
+
return "unknown";
|
|
24515
|
+
}
|
|
24436
24516
|
function detectRepoContext2(input, env = process.env) {
|
|
24437
24517
|
const repoUrl = normalizeRepoUrl2(input.repoUrl) ?? normalizeRepoUrl2(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl2(env.CI_PROJECT_URL) ?? normalizeRepoUrl2(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl2(env.BUILD_REPOSITORY_URI);
|
|
24438
24518
|
const repoSlug = normalize2(input.repoSlug) ?? normalize2(env.GITHUB_REPOSITORY) ?? normalize2(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize2(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize2(env.BUILD_REPOSITORY_NAME);
|
|
24439
24519
|
const ref = normalize2(input.ref) ?? normalize2(env.GITHUB_REF_NAME) ?? normalize2(env.CI_COMMIT_REF_NAME) ?? normalize2(env.BITBUCKET_BRANCH) ?? normalize2(env.BUILD_SOURCEBRANCHNAME);
|
|
24440
24520
|
const sha = normalize2(input.sha) ?? normalize2(env.GITHUB_SHA) ?? normalize2(env.CI_COMMIT_SHA) ?? normalize2(env.BITBUCKET_COMMIT) ?? normalize2(env.BUILD_SOURCEVERSION);
|
|
24441
24521
|
const provider = parseProvider2(input.gitProvider, repoUrl, env);
|
|
24522
|
+
const refKind = classifyRefKind(env);
|
|
24442
24523
|
return {
|
|
24443
24524
|
provider,
|
|
24444
24525
|
repoUrl,
|
|
24445
24526
|
repoSlug,
|
|
24446
24527
|
ref,
|
|
24447
|
-
sha
|
|
24528
|
+
sha,
|
|
24529
|
+
refKind
|
|
24448
24530
|
};
|
|
24449
24531
|
}
|
|
24450
24532
|
|
|
24451
24533
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
24452
24534
|
var import_node_crypto = require("node:crypto");
|
|
24453
24535
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
24454
|
-
var SCHEMA_VERSION =
|
|
24536
|
+
var SCHEMA_VERSION = 3;
|
|
24455
24537
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
24456
24538
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
24457
24539
|
var proxyDispatcher;
|
|
@@ -24462,7 +24544,7 @@ function resolveActionVersion(explicit) {
|
|
|
24462
24544
|
if (explicit) {
|
|
24463
24545
|
return explicit;
|
|
24464
24546
|
}
|
|
24465
|
-
return "1.0.
|
|
24547
|
+
return "1.0.5" ? "1.0.5" : "unknown";
|
|
24466
24548
|
}
|
|
24467
24549
|
function telemetryDisabled(env) {
|
|
24468
24550
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -24491,7 +24573,7 @@ function maybeNotice(logger) {
|
|
|
24491
24573
|
return;
|
|
24492
24574
|
}
|
|
24493
24575
|
noticeShown = true;
|
|
24494
|
-
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
24576
|
+
logger.info("note: postman-actions sends anonymous usage data (team id, action, CI provider, account type, run trigger, runner OS). Disable with POSTMAN_ACTIONS_TELEMETRY=off or DO_NOT_TRACK=1.");
|
|
24495
24577
|
}
|
|
24496
24578
|
function buildTelemetryEvent(params) {
|
|
24497
24579
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -24513,6 +24595,9 @@ function buildTelemetryEvent(params) {
|
|
|
24513
24595
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
24514
24596
|
org_id: owner ? sha256(owner) : void 0,
|
|
24515
24597
|
account_type: accountType,
|
|
24598
|
+
event_trigger: ci.eventTrigger,
|
|
24599
|
+
runner_os: ci.runnerOs,
|
|
24600
|
+
ref_kind: repo.refKind,
|
|
24516
24601
|
outcome,
|
|
24517
24602
|
ts: now()
|
|
24518
24603
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postman-cse/onboarding-repo-sync",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Postman repo sync GitHub Action.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@actions/core": "^3.0.1",
|
|
40
40
|
"@actions/exec": "^3.0.0",
|
|
41
|
-
"@postman-cse/automation-telemetry-core": "^0.
|
|
41
|
+
"@postman-cse/automation-telemetry-core": "^0.2.0",
|
|
42
42
|
"js-yaml": "^4.1.1",
|
|
43
43
|
"undici": "^6.24.0"
|
|
44
44
|
},
|