@postman-cse/onboarding-insights 1.0.3 → 1.0.4
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
|
@@ -21798,7 +21798,65 @@ function norm(value) {
|
|
|
21798
21798
|
const trimmed = (value ?? "").trim();
|
|
21799
21799
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
21800
21800
|
}
|
|
21801
|
+
function detectEventTrigger(env = process.env) {
|
|
21802
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
21803
|
+
if (ghEvent) {
|
|
21804
|
+
if (ghEvent === "push")
|
|
21805
|
+
return "push";
|
|
21806
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
21807
|
+
return "pull_request";
|
|
21808
|
+
if (ghEvent === "schedule")
|
|
21809
|
+
return "schedule";
|
|
21810
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
21811
|
+
return "manual";
|
|
21812
|
+
return "other";
|
|
21813
|
+
}
|
|
21814
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
21815
|
+
if (glSource) {
|
|
21816
|
+
if (glSource === "push")
|
|
21817
|
+
return "push";
|
|
21818
|
+
if (glSource === "merge_request_event")
|
|
21819
|
+
return "pull_request";
|
|
21820
|
+
if (glSource === "schedule")
|
|
21821
|
+
return "schedule";
|
|
21822
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
21823
|
+
return "manual";
|
|
21824
|
+
}
|
|
21825
|
+
return "other";
|
|
21826
|
+
}
|
|
21827
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
21828
|
+
return "pull_request";
|
|
21829
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
21830
|
+
return "other";
|
|
21831
|
+
}
|
|
21832
|
+
return "unknown";
|
|
21833
|
+
}
|
|
21834
|
+
function detectRunnerOs(env = process.env) {
|
|
21835
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
21836
|
+
if (runnerOs === "linux")
|
|
21837
|
+
return "linux";
|
|
21838
|
+
if (runnerOs === "macos")
|
|
21839
|
+
return "macos";
|
|
21840
|
+
if (runnerOs === "windows")
|
|
21841
|
+
return "windows";
|
|
21842
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
21843
|
+
if (platform2 === "linux")
|
|
21844
|
+
return "linux";
|
|
21845
|
+
if (platform2 === "darwin")
|
|
21846
|
+
return "macos";
|
|
21847
|
+
if (platform2 === "win32")
|
|
21848
|
+
return "windows";
|
|
21849
|
+
return "unknown";
|
|
21850
|
+
}
|
|
21801
21851
|
function detectCiContext(env = process.env) {
|
|
21852
|
+
const provider = detectCiProviderContext(env);
|
|
21853
|
+
return {
|
|
21854
|
+
...provider,
|
|
21855
|
+
eventTrigger: detectEventTrigger(env),
|
|
21856
|
+
runnerOs: detectRunnerOs(env)
|
|
21857
|
+
};
|
|
21858
|
+
}
|
|
21859
|
+
function detectCiProviderContext(env = process.env) {
|
|
21802
21860
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
21803
21861
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
21804
21862
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -21936,25 +21994,49 @@ function parseProvider(explicitProvider, repoUrl, env) {
|
|
|
21936
21994
|
}
|
|
21937
21995
|
return "unknown";
|
|
21938
21996
|
}
|
|
21997
|
+
function classifyRefKind(env = process.env) {
|
|
21998
|
+
const githubRefType = normalize(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
21999
|
+
const githubRef = normalize(env.GITHUB_REF);
|
|
22000
|
+
const azureRef = normalize(env.BUILD_SOURCEBRANCH);
|
|
22001
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize(env.CI_COMMIT_TAG) || normalize(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
22002
|
+
return "tag";
|
|
22003
|
+
}
|
|
22004
|
+
const githubRefName = normalize(env.GITHUB_REF_NAME);
|
|
22005
|
+
const githubDefault = normalize(env.GITHUB_DEFAULT_BRANCH);
|
|
22006
|
+
if (githubRefName && githubDefault) {
|
|
22007
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
22008
|
+
}
|
|
22009
|
+
const gitlabRef = normalize(env.CI_COMMIT_REF_NAME);
|
|
22010
|
+
const gitlabDefault = normalize(env.CI_DEFAULT_BRANCH);
|
|
22011
|
+
if (gitlabRef && gitlabDefault) {
|
|
22012
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
22013
|
+
}
|
|
22014
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize(env.BITBUCKET_BRANCH) || normalize(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
22015
|
+
return "branch";
|
|
22016
|
+
}
|
|
22017
|
+
return "unknown";
|
|
22018
|
+
}
|
|
21939
22019
|
function detectRepoContext(input, env = process.env) {
|
|
21940
22020
|
const repoUrl = normalizeRepoUrl(input.repoUrl) ?? normalizeRepoUrl(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl(env.CI_PROJECT_URL) ?? normalizeRepoUrl(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl(env.BUILD_REPOSITORY_URI);
|
|
21941
22021
|
const repoSlug = normalize(input.repoSlug) ?? normalize(env.GITHUB_REPOSITORY) ?? normalize(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize(env.BUILD_REPOSITORY_NAME);
|
|
21942
22022
|
const ref = normalize(input.ref) ?? normalize(env.GITHUB_REF_NAME) ?? normalize(env.CI_COMMIT_REF_NAME) ?? normalize(env.BITBUCKET_BRANCH) ?? normalize(env.BUILD_SOURCEBRANCHNAME);
|
|
21943
22023
|
const sha = normalize(input.sha) ?? normalize(env.GITHUB_SHA) ?? normalize(env.CI_COMMIT_SHA) ?? normalize(env.BITBUCKET_COMMIT) ?? normalize(env.BUILD_SOURCEVERSION);
|
|
21944
22024
|
const provider = parseProvider(input.gitProvider, repoUrl, env);
|
|
22025
|
+
const refKind = classifyRefKind(env);
|
|
21945
22026
|
return {
|
|
21946
22027
|
provider,
|
|
21947
22028
|
repoUrl,
|
|
21948
22029
|
repoSlug,
|
|
21949
22030
|
ref,
|
|
21950
|
-
sha
|
|
22031
|
+
sha,
|
|
22032
|
+
refKind
|
|
21951
22033
|
};
|
|
21952
22034
|
}
|
|
21953
22035
|
|
|
21954
22036
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
21955
22037
|
var import_node_crypto = require("node:crypto");
|
|
21956
22038
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
21957
|
-
var SCHEMA_VERSION =
|
|
22039
|
+
var SCHEMA_VERSION = 3;
|
|
21958
22040
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
21959
22041
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
21960
22042
|
var proxyDispatcher;
|
|
@@ -21965,7 +22047,7 @@ function resolveActionVersion(explicit) {
|
|
|
21965
22047
|
if (explicit) {
|
|
21966
22048
|
return explicit;
|
|
21967
22049
|
}
|
|
21968
|
-
return "1.0.
|
|
22050
|
+
return "1.0.4" ? "1.0.4" : "unknown";
|
|
21969
22051
|
}
|
|
21970
22052
|
function telemetryDisabled(env) {
|
|
21971
22053
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -21994,7 +22076,7 @@ function maybeNotice(logger) {
|
|
|
21994
22076
|
return;
|
|
21995
22077
|
}
|
|
21996
22078
|
noticeShown = true;
|
|
21997
|
-
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.");
|
|
22079
|
+
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.");
|
|
21998
22080
|
}
|
|
21999
22081
|
function buildTelemetryEvent(params) {
|
|
22000
22082
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -22016,6 +22098,9 @@ function buildTelemetryEvent(params) {
|
|
|
22016
22098
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
22017
22099
|
org_id: owner ? sha256(owner) : void 0,
|
|
22018
22100
|
account_type: accountType,
|
|
22101
|
+
event_trigger: ci.eventTrigger,
|
|
22102
|
+
runner_os: ci.runnerOs,
|
|
22103
|
+
ref_kind: repo.refKind,
|
|
22019
22104
|
outcome,
|
|
22020
22105
|
ts: now()
|
|
22021
22106
|
};
|
package/dist/cli.cjs
CHANGED
|
@@ -21813,7 +21813,65 @@ function norm(value) {
|
|
|
21813
21813
|
const trimmed = (value ?? "").trim();
|
|
21814
21814
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
21815
21815
|
}
|
|
21816
|
+
function detectEventTrigger(env = process.env) {
|
|
21817
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
21818
|
+
if (ghEvent) {
|
|
21819
|
+
if (ghEvent === "push")
|
|
21820
|
+
return "push";
|
|
21821
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
21822
|
+
return "pull_request";
|
|
21823
|
+
if (ghEvent === "schedule")
|
|
21824
|
+
return "schedule";
|
|
21825
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
21826
|
+
return "manual";
|
|
21827
|
+
return "other";
|
|
21828
|
+
}
|
|
21829
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
21830
|
+
if (glSource) {
|
|
21831
|
+
if (glSource === "push")
|
|
21832
|
+
return "push";
|
|
21833
|
+
if (glSource === "merge_request_event")
|
|
21834
|
+
return "pull_request";
|
|
21835
|
+
if (glSource === "schedule")
|
|
21836
|
+
return "schedule";
|
|
21837
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
21838
|
+
return "manual";
|
|
21839
|
+
}
|
|
21840
|
+
return "other";
|
|
21841
|
+
}
|
|
21842
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
21843
|
+
return "pull_request";
|
|
21844
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
21845
|
+
return "other";
|
|
21846
|
+
}
|
|
21847
|
+
return "unknown";
|
|
21848
|
+
}
|
|
21849
|
+
function detectRunnerOs(env = process.env) {
|
|
21850
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
21851
|
+
if (runnerOs === "linux")
|
|
21852
|
+
return "linux";
|
|
21853
|
+
if (runnerOs === "macos")
|
|
21854
|
+
return "macos";
|
|
21855
|
+
if (runnerOs === "windows")
|
|
21856
|
+
return "windows";
|
|
21857
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
21858
|
+
if (platform2 === "linux")
|
|
21859
|
+
return "linux";
|
|
21860
|
+
if (platform2 === "darwin")
|
|
21861
|
+
return "macos";
|
|
21862
|
+
if (platform2 === "win32")
|
|
21863
|
+
return "windows";
|
|
21864
|
+
return "unknown";
|
|
21865
|
+
}
|
|
21816
21866
|
function detectCiContext(env = process.env) {
|
|
21867
|
+
const provider = detectCiProviderContext(env);
|
|
21868
|
+
return {
|
|
21869
|
+
...provider,
|
|
21870
|
+
eventTrigger: detectEventTrigger(env),
|
|
21871
|
+
runnerOs: detectRunnerOs(env)
|
|
21872
|
+
};
|
|
21873
|
+
}
|
|
21874
|
+
function detectCiProviderContext(env = process.env) {
|
|
21817
21875
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
21818
21876
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
21819
21877
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -21951,25 +22009,49 @@ function parseProvider(explicitProvider, repoUrl, env) {
|
|
|
21951
22009
|
}
|
|
21952
22010
|
return "unknown";
|
|
21953
22011
|
}
|
|
22012
|
+
function classifyRefKind(env = process.env) {
|
|
22013
|
+
const githubRefType = normalize(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
22014
|
+
const githubRef = normalize(env.GITHUB_REF);
|
|
22015
|
+
const azureRef = normalize(env.BUILD_SOURCEBRANCH);
|
|
22016
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize(env.CI_COMMIT_TAG) || normalize(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
22017
|
+
return "tag";
|
|
22018
|
+
}
|
|
22019
|
+
const githubRefName = normalize(env.GITHUB_REF_NAME);
|
|
22020
|
+
const githubDefault = normalize(env.GITHUB_DEFAULT_BRANCH);
|
|
22021
|
+
if (githubRefName && githubDefault) {
|
|
22022
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
22023
|
+
}
|
|
22024
|
+
const gitlabRef = normalize(env.CI_COMMIT_REF_NAME);
|
|
22025
|
+
const gitlabDefault = normalize(env.CI_DEFAULT_BRANCH);
|
|
22026
|
+
if (gitlabRef && gitlabDefault) {
|
|
22027
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
22028
|
+
}
|
|
22029
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize(env.BITBUCKET_BRANCH) || normalize(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
22030
|
+
return "branch";
|
|
22031
|
+
}
|
|
22032
|
+
return "unknown";
|
|
22033
|
+
}
|
|
21954
22034
|
function detectRepoContext(input, env = process.env) {
|
|
21955
22035
|
const repoUrl = normalizeRepoUrl(input.repoUrl) ?? normalizeRepoUrl(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl(env.CI_PROJECT_URL) ?? normalizeRepoUrl(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl(env.BUILD_REPOSITORY_URI);
|
|
21956
22036
|
const repoSlug = normalize(input.repoSlug) ?? normalize(env.GITHUB_REPOSITORY) ?? normalize(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize(env.BUILD_REPOSITORY_NAME);
|
|
21957
22037
|
const ref = normalize(input.ref) ?? normalize(env.GITHUB_REF_NAME) ?? normalize(env.CI_COMMIT_REF_NAME) ?? normalize(env.BITBUCKET_BRANCH) ?? normalize(env.BUILD_SOURCEBRANCHNAME);
|
|
21958
22038
|
const sha = normalize(input.sha) ?? normalize(env.GITHUB_SHA) ?? normalize(env.CI_COMMIT_SHA) ?? normalize(env.BITBUCKET_COMMIT) ?? normalize(env.BUILD_SOURCEVERSION);
|
|
21959
22039
|
const provider = parseProvider(input.gitProvider, repoUrl, env);
|
|
22040
|
+
const refKind = classifyRefKind(env);
|
|
21960
22041
|
return {
|
|
21961
22042
|
provider,
|
|
21962
22043
|
repoUrl,
|
|
21963
22044
|
repoSlug,
|
|
21964
22045
|
ref,
|
|
21965
|
-
sha
|
|
22046
|
+
sha,
|
|
22047
|
+
refKind
|
|
21966
22048
|
};
|
|
21967
22049
|
}
|
|
21968
22050
|
|
|
21969
22051
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
21970
22052
|
var import_node_crypto = require("node:crypto");
|
|
21971
22053
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
21972
|
-
var SCHEMA_VERSION =
|
|
22054
|
+
var SCHEMA_VERSION = 3;
|
|
21973
22055
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
21974
22056
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
21975
22057
|
var proxyDispatcher;
|
|
@@ -21980,7 +22062,7 @@ function resolveActionVersion(explicit) {
|
|
|
21980
22062
|
if (explicit) {
|
|
21981
22063
|
return explicit;
|
|
21982
22064
|
}
|
|
21983
|
-
return "1.0.
|
|
22065
|
+
return "1.0.4" ? "1.0.4" : "unknown";
|
|
21984
22066
|
}
|
|
21985
22067
|
function telemetryDisabled(env) {
|
|
21986
22068
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -22009,7 +22091,7 @@ function maybeNotice(logger) {
|
|
|
22009
22091
|
return;
|
|
22010
22092
|
}
|
|
22011
22093
|
noticeShown = true;
|
|
22012
|
-
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.");
|
|
22094
|
+
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.");
|
|
22013
22095
|
}
|
|
22014
22096
|
function buildTelemetryEvent(params) {
|
|
22015
22097
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -22031,6 +22113,9 @@ function buildTelemetryEvent(params) {
|
|
|
22031
22113
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
22032
22114
|
org_id: owner ? sha256(owner) : void 0,
|
|
22033
22115
|
account_type: accountType,
|
|
22116
|
+
event_trigger: ci.eventTrigger,
|
|
22117
|
+
runner_os: ci.runnerOs,
|
|
22118
|
+
ref_kind: repo.refKind,
|
|
22034
22119
|
outcome,
|
|
22035
22120
|
ts: now()
|
|
22036
22121
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -21818,7 +21818,65 @@ function norm(value) {
|
|
|
21818
21818
|
const trimmed = (value ?? "").trim();
|
|
21819
21819
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
21820
21820
|
}
|
|
21821
|
+
function detectEventTrigger(env = process.env) {
|
|
21822
|
+
const ghEvent = norm(env.GITHUB_EVENT_NAME)?.toLowerCase();
|
|
21823
|
+
if (ghEvent) {
|
|
21824
|
+
if (ghEvent === "push")
|
|
21825
|
+
return "push";
|
|
21826
|
+
if (ghEvent === "pull_request" || ghEvent === "pull_request_target")
|
|
21827
|
+
return "pull_request";
|
|
21828
|
+
if (ghEvent === "schedule")
|
|
21829
|
+
return "schedule";
|
|
21830
|
+
if (ghEvent === "workflow_dispatch" || ghEvent === "repository_dispatch")
|
|
21831
|
+
return "manual";
|
|
21832
|
+
return "other";
|
|
21833
|
+
}
|
|
21834
|
+
const glSource = norm(env.CI_PIPELINE_SOURCE)?.toLowerCase();
|
|
21835
|
+
if (glSource) {
|
|
21836
|
+
if (glSource === "push")
|
|
21837
|
+
return "push";
|
|
21838
|
+
if (glSource === "merge_request_event")
|
|
21839
|
+
return "pull_request";
|
|
21840
|
+
if (glSource === "schedule")
|
|
21841
|
+
return "schedule";
|
|
21842
|
+
if (glSource === "web" || glSource === "api" || glSource === "trigger" || glSource === "pipeline") {
|
|
21843
|
+
return "manual";
|
|
21844
|
+
}
|
|
21845
|
+
return "other";
|
|
21846
|
+
}
|
|
21847
|
+
if (norm(env.BITBUCKET_PR_ID))
|
|
21848
|
+
return "pull_request";
|
|
21849
|
+
if (norm(env.CI) || norm(env.BUILD_BUILDID) || norm(env.JENKINS_URL) || norm(env.TEAMCITY_VERSION)) {
|
|
21850
|
+
return "other";
|
|
21851
|
+
}
|
|
21852
|
+
return "unknown";
|
|
21853
|
+
}
|
|
21854
|
+
function detectRunnerOs(env = process.env) {
|
|
21855
|
+
const runnerOs = norm(env.RUNNER_OS)?.toLowerCase();
|
|
21856
|
+
if (runnerOs === "linux")
|
|
21857
|
+
return "linux";
|
|
21858
|
+
if (runnerOs === "macos")
|
|
21859
|
+
return "macos";
|
|
21860
|
+
if (runnerOs === "windows")
|
|
21861
|
+
return "windows";
|
|
21862
|
+
const platform2 = typeof process !== "undefined" ? process.platform : void 0;
|
|
21863
|
+
if (platform2 === "linux")
|
|
21864
|
+
return "linux";
|
|
21865
|
+
if (platform2 === "darwin")
|
|
21866
|
+
return "macos";
|
|
21867
|
+
if (platform2 === "win32")
|
|
21868
|
+
return "windows";
|
|
21869
|
+
return "unknown";
|
|
21870
|
+
}
|
|
21821
21871
|
function detectCiContext(env = process.env) {
|
|
21872
|
+
const provider = detectCiProviderContext(env);
|
|
21873
|
+
return {
|
|
21874
|
+
...provider,
|
|
21875
|
+
eventTrigger: detectEventTrigger(env),
|
|
21876
|
+
runnerOs: detectRunnerOs(env)
|
|
21877
|
+
};
|
|
21878
|
+
}
|
|
21879
|
+
function detectCiProviderContext(env = process.env) {
|
|
21822
21880
|
if (norm(env.GITHUB_ACTIONS)) {
|
|
21823
21881
|
const runnerEnv = norm(env.RUNNER_ENVIRONMENT);
|
|
21824
21882
|
const runnerKind = runnerEnv === "github-hosted" ? "hosted" : runnerEnv === "self-hosted" ? "self-hosted" : "unknown";
|
|
@@ -21956,25 +22014,49 @@ function parseProvider(explicitProvider, repoUrl, env) {
|
|
|
21956
22014
|
}
|
|
21957
22015
|
return "unknown";
|
|
21958
22016
|
}
|
|
22017
|
+
function classifyRefKind(env = process.env) {
|
|
22018
|
+
const githubRefType = normalize(env.GITHUB_REF_TYPE)?.toLowerCase();
|
|
22019
|
+
const githubRef = normalize(env.GITHUB_REF);
|
|
22020
|
+
const azureRef = normalize(env.BUILD_SOURCEBRANCH);
|
|
22021
|
+
if (githubRefType === "tag" || githubRef?.startsWith("refs/tags/") || normalize(env.CI_COMMIT_TAG) || normalize(env.BITBUCKET_TAG) || azureRef?.startsWith("refs/tags/")) {
|
|
22022
|
+
return "tag";
|
|
22023
|
+
}
|
|
22024
|
+
const githubRefName = normalize(env.GITHUB_REF_NAME);
|
|
22025
|
+
const githubDefault = normalize(env.GITHUB_DEFAULT_BRANCH);
|
|
22026
|
+
if (githubRefName && githubDefault) {
|
|
22027
|
+
return githubRefName === githubDefault ? "default-branch" : "branch";
|
|
22028
|
+
}
|
|
22029
|
+
const gitlabRef = normalize(env.CI_COMMIT_REF_NAME);
|
|
22030
|
+
const gitlabDefault = normalize(env.CI_DEFAULT_BRANCH);
|
|
22031
|
+
if (gitlabRef && gitlabDefault) {
|
|
22032
|
+
return gitlabRef === gitlabDefault ? "default-branch" : "branch";
|
|
22033
|
+
}
|
|
22034
|
+
if (githubRefName || githubRef?.startsWith("refs/heads/") || gitlabRef || normalize(env.BITBUCKET_BRANCH) || normalize(env.BUILD_SOURCEBRANCHNAME) || azureRef?.startsWith("refs/heads/")) {
|
|
22035
|
+
return "branch";
|
|
22036
|
+
}
|
|
22037
|
+
return "unknown";
|
|
22038
|
+
}
|
|
21959
22039
|
function detectRepoContext(input, env = process.env) {
|
|
21960
22040
|
const repoUrl = normalizeRepoUrl(input.repoUrl) ?? normalizeRepoUrl(env.GITHUB_SERVER_URL && env.GITHUB_REPOSITORY ? `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}` : void 0) ?? normalizeRepoUrl(env.CI_PROJECT_URL) ?? normalizeRepoUrl(env.BITBUCKET_GIT_HTTP_ORIGIN) ?? normalizeRepoUrl(env.BUILD_REPOSITORY_URI);
|
|
21961
22041
|
const repoSlug = normalize(input.repoSlug) ?? normalize(env.GITHUB_REPOSITORY) ?? normalize(env.CI_PROJECT_PATH) ?? (env.BITBUCKET_WORKSPACE && env.BITBUCKET_REPO_SLUG ? normalize(`${env.BITBUCKET_WORKSPACE}/${env.BITBUCKET_REPO_SLUG}`) : void 0) ?? normalize(env.BUILD_REPOSITORY_NAME);
|
|
21962
22042
|
const ref = normalize(input.ref) ?? normalize(env.GITHUB_REF_NAME) ?? normalize(env.CI_COMMIT_REF_NAME) ?? normalize(env.BITBUCKET_BRANCH) ?? normalize(env.BUILD_SOURCEBRANCHNAME);
|
|
21963
22043
|
const sha = normalize(input.sha) ?? normalize(env.GITHUB_SHA) ?? normalize(env.CI_COMMIT_SHA) ?? normalize(env.BITBUCKET_COMMIT) ?? normalize(env.BUILD_SOURCEVERSION);
|
|
21964
22044
|
const provider = parseProvider(input.gitProvider, repoUrl, env);
|
|
22045
|
+
const refKind = classifyRefKind(env);
|
|
21965
22046
|
return {
|
|
21966
22047
|
provider,
|
|
21967
22048
|
repoUrl,
|
|
21968
22049
|
repoSlug,
|
|
21969
22050
|
ref,
|
|
21970
|
-
sha
|
|
22051
|
+
sha,
|
|
22052
|
+
refKind
|
|
21971
22053
|
};
|
|
21972
22054
|
}
|
|
21973
22055
|
|
|
21974
22056
|
// node_modules/@postman-cse/automation-telemetry-core/dist/telemetry.js
|
|
21975
22057
|
var import_node_crypto = require("node:crypto");
|
|
21976
22058
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
21977
|
-
var SCHEMA_VERSION =
|
|
22059
|
+
var SCHEMA_VERSION = 3;
|
|
21978
22060
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
21979
22061
|
var DEFAULT_ENDPOINT = "https://events.pm-cse.dev/v1/events";
|
|
21980
22062
|
var proxyDispatcher;
|
|
@@ -21985,7 +22067,7 @@ function resolveActionVersion(explicit) {
|
|
|
21985
22067
|
if (explicit) {
|
|
21986
22068
|
return explicit;
|
|
21987
22069
|
}
|
|
21988
|
-
return "1.0.
|
|
22070
|
+
return "1.0.4" ? "1.0.4" : "unknown";
|
|
21989
22071
|
}
|
|
21990
22072
|
function telemetryDisabled(env) {
|
|
21991
22073
|
const flag = String(env.POSTMAN_ACTIONS_TELEMETRY ?? "").trim().toLowerCase();
|
|
@@ -22014,7 +22096,7 @@ function maybeNotice(logger) {
|
|
|
22014
22096
|
return;
|
|
22015
22097
|
}
|
|
22016
22098
|
noticeShown = true;
|
|
22017
|
-
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.");
|
|
22099
|
+
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.");
|
|
22018
22100
|
}
|
|
22019
22101
|
function buildTelemetryEvent(params) {
|
|
22020
22102
|
const { action, actionVersion, teamId, accountType, outcome, env, now } = params;
|
|
@@ -22036,6 +22118,9 @@ function buildTelemetryEvent(params) {
|
|
|
22036
22118
|
repo_id: repoSource ? sha256(repoSource) : void 0,
|
|
22037
22119
|
org_id: owner ? sha256(owner) : void 0,
|
|
22038
22120
|
account_type: accountType,
|
|
22121
|
+
event_trigger: ci.eventTrigger,
|
|
22122
|
+
runner_os: ci.runnerOs,
|
|
22123
|
+
ref_kind: repo.refKind,
|
|
22039
22124
|
outcome,
|
|
22040
22125
|
ts: now()
|
|
22041
22126
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postman-cse/onboarding-insights",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "GitHub Action to onboard Postman Insights discovered services to API Catalog workspaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@actions/core": "^3.0.1",
|
|
38
|
-
"@postman-cse/automation-telemetry-core": "^0.
|
|
38
|
+
"@postman-cse/automation-telemetry-core": "^0.2.0",
|
|
39
39
|
"undici": "^6.24.0"
|
|
40
40
|
},
|
|
41
41
|
"overrides": {
|