Skip to content

Commit ecc28bf

Browse files
authored
Testing for 2.9.0 release (#141)
2 parents 890bb2e + cc07ea1 commit ecc28bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2546
-894
lines changed

.github/actions/auth/package-lock.json

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

.github/actions/auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"type": "module",
1515
"dependencies": {
1616
"@actions/core": "^2.0.1",
17-
"playwright": "^1.57.0"
17+
"playwright": "^1.58.1"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^25.0.3",
20+
"@types/node": "^25.2.0",
2121
"typescript": "^5.9.3"
2222
}
2323
}

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

Lines changed: 52 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,96 @@
1-
import type { AuthContextOutput } from "./types.d.js";
2-
import crypto from "node:crypto";
3-
import process from "node:process";
4-
import * as url from "node:url";
5-
import core from "@actions/core";
6-
import playwright from "playwright";
1+
import type {AuthContextOutput} from './types.d.js'
2+
import process from 'node:process'
3+
import core from '@actions/core'
4+
import playwright from 'playwright'
75

86
export default async function () {
9-
core.info("Starting 'auth' action");
7+
core.info("Starting 'auth' action")
108

11-
let browser: playwright.Browser | undefined;
12-
let context: playwright.BrowserContext | undefined;
13-
let page: playwright.Page | undefined;
9+
let browser: playwright.Browser | undefined
10+
let context: playwright.BrowserContext | undefined
11+
let page: playwright.Page | undefined
1412
try {
1513
// Get inputs
16-
const loginUrl = core.getInput("login_url", { required: true });
17-
const username = core.getInput("username", { required: true });
18-
const password = core.getInput("password", { required: true });
19-
core.setSecret(password);
20-
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`;
14+
const loginUrl = core.getInput('login_url', {required: true})
15+
const username = core.getInput('username', {required: true})
16+
const password = core.getInput('password', {required: true})
17+
core.setSecret(password)
2718

2819
// Launch a headless browser
2920
browser = await playwright.chromium.launch({
3021
headless: true,
31-
executablePath: process.env.CI ? "/usr/bin/google-chrome" : undefined,
32-
});
22+
executablePath: process.env.CI ? '/usr/bin/google-chrome' : undefined,
23+
})
3324
context = await browser.newContext({
3425
// Try HTTP Basic authentication
3526
httpCredentials: {
3627
username,
3728
password,
3829
},
39-
});
40-
page = await context.newPage();
30+
})
31+
page = await context.newPage()
4132

4233
// Navigate to login page
43-
core.info("Navigating to login page");
44-
await page.goto(loginUrl);
34+
core.info('Navigating to login page')
35+
await page.goto(loginUrl)
4536

4637
// Check for a login form.
4738
// If no login form is found, then either HTTP Basic auth succeeded, or the page does not require authentication.
48-
core.info("Checking for login form");
39+
core.info('Checking for login form')
4940
const [usernameField, passwordField] = await Promise.all([
5041
page.getByLabel(/user ?name/i).first(),
5142
page.getByLabel(/password/i).first(),
52-
]);
53-
const [usernameFieldExists, passwordFieldExists] = await Promise.all([
54-
usernameField.count(),
55-
passwordField.count(),
56-
]);
43+
])
44+
const [usernameFieldExists, passwordFieldExists] = await Promise.all([usernameField.count(), passwordField.count()])
5745
if (usernameFieldExists && passwordFieldExists) {
5846
// Try form authentication
59-
core.info("Filling username");
60-
await usernameField.fill(username);
61-
core.info("Filling password");
62-
await passwordField.fill(password);
63-
core.info("Logging in");
47+
core.info('Filling username')
48+
await usernameField.fill(username)
49+
core.info('Filling password')
50+
await passwordField.fill(password)
51+
core.info('Logging in')
6452
await page
6553
.getByLabel(/password/i)
66-
.locator("xpath=ancestor::form")
67-
.evaluate((form) => (form as HTMLFormElement).submit());
54+
.locator('xpath=ancestor::form')
55+
.evaluate(form => (form as HTMLFormElement).submit())
6856
} else {
69-
core.info("No login form detected");
57+
core.info('No login form detected')
7058
// This occurs if HTTP Basic auth succeeded, or if the page does not require authentication.
7159
}
7260

7361
// Output authenticated session state
74-
const { cookies, origins } = await context.storageState();
62+
const {cookies, origins} = await context.storageState()
7563
const authContextOutput: AuthContextOutput = {
7664
username,
7765
password,
7866
cookies,
79-
localStorage: origins.reduce((acc, { origin, localStorage }) => {
80-
acc[origin] = localStorage.reduce((acc, { name, value }) => {
81-
acc[name] = value;
82-
return acc;
83-
}, {} as Record<string, string>);
84-
return acc;
85-
}, {} as Record<string, Record<string, string>>),
86-
};
87-
core.setOutput("auth_context", JSON.stringify(authContextOutput));
88-
core.debug("Output: 'auth_context'");
67+
localStorage: origins.reduce(
68+
(acc, {origin, localStorage}) => {
69+
acc[origin] = localStorage.reduce(
70+
(acc, {name, value}) => {
71+
acc[name] = value
72+
return acc
73+
},
74+
{} as Record<string, string>,
75+
)
76+
return acc
77+
},
78+
{} as Record<string, Record<string, string>>,
79+
),
80+
}
81+
core.setOutput('auth_context', JSON.stringify(authContextOutput))
82+
core.debug("Output: 'auth_context'")
8983
} catch (error) {
9084
if (page) {
91-
core.info(`Errored at page URL: ${page.url()}`);
85+
core.info(`Errored at page URL: ${page.url()}`)
9286
}
93-
core.setFailed(`${error}`);
94-
process.exit(1);
87+
core.setFailed(`${error}`)
88+
process.exit(1)
9589
} finally {
9690
// Clean up
97-
await context?.close();
98-
await browser?.close();
91+
await context?.close()
92+
await browser?.close()
9993
}
10094

101-
core.info("Finished 'auth' action");
95+
core.info("Finished 'auth' action")
10296
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
export type Cookie = {
2-
name: string;
3-
value: string;
4-
domain: string;
5-
path: string;
6-
expires?: number;
7-
httpOnly?: boolean;
8-
secure?: boolean;
9-
sameSite?: "Strict" | "Lax" | "None";
10-
};
2+
name: string
3+
value: string
4+
domain: string
5+
path: string
6+
expires?: number
7+
httpOnly?: boolean
8+
secure?: boolean
9+
sameSite?: 'Strict' | 'Lax' | 'None'
10+
}
1111

1212
export type LocalStorage = {
1313
[origin: string]: {
14-
[key: string]: string;
15-
};
16-
};
14+
[key: string]: string
15+
}
16+
}
1717

1818
export type AuthContextOutput = {
19-
username?: string;
20-
password?: string;
21-
cookies?: Cookie[];
22-
localStorage?: LocalStorage;
23-
};
19+
username?: string
20+
password?: string
21+
cookies?: Cookie[]
22+
localStorage?: LocalStorage
23+
}

.github/actions/file/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
cached_filings:
1515
description: "Cached filings from previous runs, as stringified JSON. Without this, duplicate issues may be filed."
1616
required: false
17+
screenshot_repository:
18+
description: "Repository (with owner) where screenshots are stored on the gh-cache branch. Defaults to the 'repository' input if not set. Required if issues are open in a different repo to construct proper screenshot URLs."
19+
required: false
1720

1821
outputs:
1922
filings:

.github/actions/file/package-lock.json

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

.github/actions/file/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@octokit/plugin-throttling": "^11.0.3"
1919
},
2020
"devDependencies": {
21-
"@types/node": "^25.0.3",
21+
"@types/node": "^25.2.0",
2222
"typescript": "^5.9.3"
2323
}
2424
}

0 commit comments

Comments
 (0)