Skip to content

Commit 7320f1c

Browse files
committed
Testing reverting file
1 parent 0a35dcc commit 7320f1c

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { AuthContextOutput } from "./types.d.js";
2+
import crypto from "node:crypto";
23
import process from "node:process";
4+
import * as url from "node:url";
35
import core from "@actions/core";
46
import playwright from "playwright";
57

@@ -16,6 +18,13 @@ export default async function () {
1618
const password = core.getInput("password", { required: true });
1719
core.setSecret(password);
1820

21+
// Determine storage path for authenticated session state
22+
// Playwright will create missing directories, if needed
23+
const actionDirectory = `${url.fileURLToPath(new URL(import.meta.url))}/..`;
24+
const sessionStatePath = `${
25+
process.env.RUNNER_TEMP ?? actionDirectory
26+
}/.auth/${crypto.randomUUID()}/sessionState.json`;
27+
1928
// Launch a headless browser
2029
browser = await playwright.chromium.launch({
2130
headless: true,
@@ -67,19 +76,13 @@ export default async function () {
6776
username,
6877
password,
6978
cookies,
70-
localStorage: origins.reduce(
71-
(acc, { origin, localStorage }) => {
72-
acc[origin] = localStorage.reduce(
73-
(acc, { name, value }) => {
74-
acc[name] = value;
75-
return acc;
76-
},
77-
{} as Record<string, string>,
78-
);
79+
localStorage: origins.reduce((acc, { origin, localStorage }) => {
80+
acc[origin] = localStorage.reduce((acc, { name, value }) => {
81+
acc[name] = value;
7982
return acc;
80-
},
81-
{} as Record<string, Record<string, string>>,
82-
),
83+
}, {} as Record<string, string>);
84+
return acc;
85+
}, {} as Record<string, Record<string, string>>),
8386
};
8487
core.setOutput("auth_context", JSON.stringify(authContextOutput));
8588
core.debug("Output: 'auth_context'");

0 commit comments

Comments
 (0)