Skip to content

Commit 49efc2c

Browse files
committed
fix: Simplify session state path creation, given Playwright’s internals
1 parent f3cf77d commit 49efc2c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.github/actions/auth/src/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import crypto from "node:crypto";
2-
import fs from "node:fs/promises";
32
import process from "node:process";
43
import * as url from "node:url";
54
import core from "@actions/core";
@@ -18,13 +17,12 @@ export default async function () {
1817
const password = core.getInput("password", { required: true });
1918
core.setSecret(password);
2019

21-
// Create a temporary directory for authenticated session state
20+
// Determine storage path for authenticated session state
21+
// Playwright will create missing directories, if needed
2222
const actionDirectory = `${url.fileURLToPath(new URL(import.meta.url))}/..`;
23-
const sessionStateDirectory = `${
23+
const sessionStatePath = `${
2424
process.env.RUNNER_TEMP ?? actionDirectory
25-
}/.auth/${crypto.randomUUID()}`;
26-
await fs.mkdir(sessionStateDirectory, { recursive: true });
27-
const sessionStatePath = `${sessionStateDirectory}/sessionState.json`;
25+
}/.auth/${crypto.randomUUID()}/sessionState.json`;
2826

2927
// Launch a headless browser
3028
browser = await playwright.chromium.launch({

0 commit comments

Comments
 (0)