Skip to content

Commit 4ae326b

Browse files
author
Amram Englander
committed
Fix session expiry to use auth token, auto-publish on release
1 parent 47a1461 commit 4ae326b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Publish to npm
22

33
on:
44
workflow_dispatch:
5+
release:
6+
types: [published]
57

68
jobs:
79
publish:

src/auth/BrowserLogin.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ export async function browserLogin(): Promise<{
6464
throw new Error("No cookies found — login may not have completed.");
6565
}
6666

67-
// Find the earliest expiry among cookies that actually expire.
68-
// Playwright uses -1 or 0 for session cookies (no expiry).
69-
const expiries = playwrightCookies
70-
.map((c) => c.expires)
71-
.filter((e) => e > 0);
72-
const expiresAt = expiries.length > 0
73-
? new Date(Math.min(...expiries) * 1000).toISOString()
67+
// Find the auth token cookie expiry. Short-lived analytics cookies are
68+
// ignored — we care about when the actual auth session expires.
69+
const authCookie = playwrightCookies.find((c) => c.name === "__Host-auth-token");
70+
const expiresAt = authCookie && authCookie.expires > 0
71+
? new Date(authCookie.expires * 1000).toISOString()
7472
: null;
7573

7674
// Try to extract the commit hash from the app JS bundle filename.

0 commit comments

Comments
 (0)