Merge pull request #197 from detsys-pr-bot/detsys-ts-update-0095c476e55f64d04f1aa1e1bcc2524c329d073a
Some checks are pending
CI / typescript-action (push) Waiting to run
CI / validate (push) Waiting to run

Update `detsys-ts`: Skip complicated rewrites, record groups. (#104)
This commit is contained in:
Graham Christensen 2025-07-03 06:23:26 -07:00 committed by GitHub
commit 9070c89246
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 335 additions and 328 deletions

127
dist/index.js vendored
View file

@ -89478,7 +89478,7 @@ var cache = __nccwpck_require__(7389);
var external_child_process_ = __nccwpck_require__(5317);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(6928);
;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+5084fa8e3263a_a2ac939c447d828e4767290fb0939d82/node_modules/detsys-ts/dist/index.js
;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+0095c476e55f6_afe2535b95cf72dc75f2dc7dcdd6a059/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
@ -89864,44 +89864,15 @@ async function collectBacktracesSystemd(prefixes, programNameDenyList, startTime
var OPTIONAL_VARIABLES = ["INVOCATION_ID"];
function identify(projectName) {
const ident = {
correlation_source: "github-actions",
repository: hashEnvironmentVariables("GHR", [
function identify() {
const repository = hashEnvironmentVariables("GHR", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID"
]),
workflow: hashEnvironmentVariables("GHW", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW"
]),
job: hashEnvironmentVariables("GHWJ", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW",
"GITHUB_JOB"
]),
run: hashEnvironmentVariables("GHWJR", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW",
"GITHUB_JOB",
"GITHUB_RUN_ID"
]),
run_differentiator: hashEnvironmentVariables("GHWJA", [
]);
const run_differentiator = hashEnvironmentVariables("GHWJA", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
@ -89913,10 +89884,42 @@ function identify(projectName) {
"GITHUB_RUN_NUMBER",
"GITHUB_RUN_ATTEMPT",
"INVOCATION_ID"
]);
const ident = {
$anon_distinct_id: process.env["RUNNER_TRACKING_ID"] || (0,external_crypto_.randomUUID)(),
correlation_source: "github-actions",
github_repository_hash: repository,
github_workflow_hash: hashEnvironmentVariables("GHW", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW"
]),
groups: {
ci: "github-actions",
project: projectName,
github_workflow_job_hash: hashEnvironmentVariables("GHWJ", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW",
"GITHUB_JOB"
]),
github_workflow_run_hash: hashEnvironmentVariables("GHWJR", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID",
"GITHUB_REPOSITORY",
"GITHUB_REPOSITORY_ID",
"GITHUB_WORKFLOW",
"GITHUB_JOB",
"GITHUB_RUN_ID"
]),
github_workflow_run_differentiator_hash: run_differentiator,
$session_id: run_differentiator,
$groups: {
github_repository: repository,
github_organization: hashEnvironmentVariables("GHO", [
"GITHUB_SERVER_URL",
"GITHUB_REPOSITORY_OWNER",
@ -90079,9 +90082,7 @@ var IdsHost = class {
}
try {
const diagnosticUrl = await this.getRootUrl();
diagnosticUrl.pathname += this.idsProjectName;
diagnosticUrl.pathname += "/";
diagnosticUrl.pathname += this.diagnosticsSuffix || "diagnostics";
diagnosticUrl.pathname += "events/batch";
return diagnosticUrl;
} catch (err) {
core.info(
@ -90485,9 +90486,10 @@ var DetSysAction = class {
this.facts[target] = value;
}
}
this.identity = identify(this.actionOptions.name);
this.identity = identify();
this.archOs = getArchOs();
this.nixSystem = getNixPlatform(this.archOs);
this.facts.$app_name = `${this.actionOptions.name}/action`;
this.facts.arch_os = this.archOs;
this.facts.nix_system = this.nixSystem;
{
@ -90553,7 +90555,7 @@ var DetSysAction = class {
return await this.idsHost.getDiagnosticsUrl();
}
getUniqueId() {
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_crypto_.randomUUID)();
return this.identity.github_workflow_run_differentiator_hash || process.env.RUNNER_TRACKING_ID || (0,external_crypto_.randomUUID)();
}
// This ID will be saved in the action's state, to be persisted across phase steps
getCrossPhaseId() {
@ -90570,13 +90572,20 @@ var DetSysAction = class {
recordEvent(eventName, context = {}) {
const prefixedName = eventName === "$feature_flag_called" ? eventName : `${this.actionOptions.eventPrefix}${eventName}`;
this.events.push({
event_name: prefixedName,
context,
correlation: this.identity,
facts: this.facts,
features: this.featureEventMetadata,
name: prefixedName,
// Use the anon distinct ID as the distinct ID until we actually have a distinct ID in the future
distinct_id: this.identity.$anon_distinct_id,
// distinct_id
uuid: (0,external_crypto_.randomUUID)(),
timestamp: /* @__PURE__ */ new Date(),
uuid: (0,external_crypto_.randomUUID)()
properties: {
...context,
...this.identity,
...this.facts,
...Object.fromEntries(
Object.entries(this.featureEventMetadata).map(([name, variant]) => [`$feature/${name}`, variant])
)
}
});
}
/**
@ -90747,12 +90756,19 @@ var DetSysAction = class {
}
try {
core.debug(`Preflighting via ${checkInUrl}`);
checkInUrl.searchParams.set("ci", "github");
checkInUrl.searchParams.set(
"correlation",
JSON.stringify(this.identity)
);
return (await this.getClient()).get(checkInUrl, {
const props = {
// Use a distinct_id when we actually have one
distinct_id: this.identity.$anon_distinct_id,
anon_distinct_id: this.identity.$anon_distinct_id,
groups: this.identity.$groups,
person_properties: {
ci: "github",
...this.identity,
...this.facts
}
};
return (await this.getClient()).post(checkInUrl, {
json: props,
timeout: {
request: CHECK_IN_ENDPOINT_TIMEOUT_MS
}
@ -91093,9 +91109,8 @@ var DetSysAction = class {
return;
}
const batch = {
type: "eventlog",
sent_at: /* @__PURE__ */ new Date(),
events: this.events
batch: this.events
};
try {
await (await this.getClient()).post(diagnosticsUrl, {

View file

@ -38,8 +38,8 @@
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.0",
"prettier": "^3.6.0",
"eslint-plugin-prettier": "^5.5.1",
"prettier": "^3.6.2",
"tsup": "^8.5.0",
"typescript": "^5.8.3",
"vitest": "^3.2.4"

550
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff