Skip to content

Commit cb6d4e8

Browse files
Standardize login failure events
1 parent e686131 commit cb6d4e8

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ const EVENT_UNINSTALL_NIX = "uninstall";
2626

2727
// FlakeHub events
2828
const EVENT_LOGIN_TO_FLAKEHUB = "login_to_flakehub";
29+
const EVENT_LOGIN_FAILURE = "flakehub-login:failure";
2930

3031
// Other events
3132
const EVENT_CONCLUDE_JOB = "conclude_job";
3233
const EVENT_FOD_ANNOTATE = "fod_annotate";
3334
const EVENT_NO_SYSTEMD_SHIM_FAILED = "no-systemd-shim-failed";
3435

35-
const EVENT_AUTH_SKIP_FORK = "auth-skip:fork";
36-
const EVENT_AUTH_SKIP_NOT_CONFIGURED = "auth-skip:not-configured";
37-
3836
// Feature flag names
3937
const FEAT_ANNOTATIONS = "hash-mismatch-annotations";
4038

@@ -728,14 +726,14 @@ class NixInstallerAction extends DetSysAction {
728726
const head = pr?.head?.repo?.full_name;
729727

730728
if (pr && base !== head) {
731-
this.recordEvent(EVENT_AUTH_SKIP_FORK);
729+
this.recordEvent(EVENT_LOGIN_FAILURE, { reason: "fork" });
732730
actionsCore.info(
733731
`Not logging in to FlakeHub: GitHub Actions does not allow OIDC authentication from forked repositories ("${head}" is not the same repository as "${base}").`,
734732
);
735733
return;
736734
}
737735

738-
this.recordEvent(EVENT_AUTH_SKIP_NOT_CONFIGURED);
736+
this.recordEvent(EVENT_LOGIN_FAILURE, { reason: "not-configured" });
739737

740738
actionsCore.info(
741739
`Not logging in to FlakeHub: GitHub Actions has not provided OIDC token endpoints; please make sure that \`id-token: write\` and \`contents: read\` are set for this step's (or job's) permissions.`,
@@ -752,7 +750,8 @@ class NixInstallerAction extends DetSysAction {
752750
await actionsExec.exec(`determinate-nixd`, ["login", "github-action"]);
753751
} catch (e: unknown) {
754752
actionsCore.warning(`FlakeHub Login failure: ${stringifyError(e)}`);
755-
this.recordEvent("flakehub-login:failure", {
753+
this.recordEvent(EVENT_LOGIN_FAILURE, {
754+
reason: "failed",
756755
exception: stringifyError(e),
757756
});
758757
}

0 commit comments

Comments
 (0)