Change playwright to always use env vars (#5851)

* Change playwright to always use env vars

* Change to not be so noisy
This commit is contained in:
Jonathan Tran
2025-03-17 20:00:07 -04:00
committed by GitHub
parent ff6186f4f0
commit cb0470a31d

View File

@ -1,8 +1,9 @@
import { readFileSync } from 'fs' import { readFileSync } from 'fs'
const secrets: Record<string, string> = {} const secrets: Record<string, string> = {}
const secretsPath = './e2e/playwright/playwright-secrets.env'
try { try {
const file = readFileSync('./e2e/playwright/playwright-secrets.env', 'utf8') const file = readFileSync(secretsPath, 'utf8')
file file
.split('\n') .split('\n')
.filter((line) => line && line.length > 1) .filter((line) => line && line.length > 1)
@ -15,9 +16,12 @@ try {
}) })
} catch (err) { } catch (err) {
// probably running in CI // probably running in CI
secrets.token = process.env.token || '' console.warn(
secrets.snapshottoken = process.env.snapshottoken || '' `Error reading ${secretsPath}; environment variables will be used`
// add more env vars here to make them available in CI )
} }
secrets.token = secrets.token || process.env.token || ''
secrets.snapshottoken = secrets.snapshottoken || process.env.snapshottoken || ''
// add more env vars here to make them available in CI
export { secrets } export { secrets }