Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120288,6 +120288,17 @@ function findResultsJson() {
return c;
return null;
}
function writeDotEnvLocal(workspace, vars) {
// The PHP library reads env vars through phpdotenv (Dotenv::createImmutable),
// which only picks up .env / .env.local files — NOT process env, unless PHP
// is built with variables_order including 'E' (rarely the case in CI).
// Writing .env.local (loaded before .env, values are immutable so they win)
// guarantees the lib sees our values regardless of PHP config.
const path = `${workspace}/.env.local`;
const body = Object.entries(vars).map(([k, v]) => `${k}=${v}`).join('\n') + '\n';
fs.writeFileSync(path, body);
core.info(`Wrote ${Object.keys(vars).length} vars to ${path}`);
}
async function run() {
let flashlight = null;
let stepFailed = false;
Expand All @@ -120314,6 +120325,10 @@ async function run() {
flashlight = await (0, docker_1.startFlashlight)({ composeYaml, port });
env.PRESTAFLOW_FO_URL = `${flashlight.url}/`;
env.PRESTAFLOW_PS_VERSION = inputs.psVersion;
writeDotEnvLocal(workspace, {
PRESTAFLOW_FO_URL: `${flashlight.url}/`,
PRESTAFLOW_PS_VERSION: inputs.psVersion,
});
core.info(`Flashlight ready at ${flashlight.url} (PS ${inputs.psVersion})`);
}
try {
Expand All @@ -120340,7 +120355,19 @@ async function run() {
else {
core.warning('No results.json found — outputs will be zeros.');
}
const uploaded = await (0, api_1.uploadToApi)({ token: inputs.token, projectId: inputs.projectId });
let uploaded = { id: '', url: '' };
if (resultsPath) {
try {
uploaded = await (0, api_1.uploadToApi)({ token: inputs.token, projectId: inputs.projectId });
}
catch (e) {
const msg = e instanceof Error ? e.message : String(e);
core.warning(`API upload failed: ${msg}`);
}
}
else {
core.info('Skipping API upload (no results.json to send).');
}
if (inputs.uploadArtifacts) {
await (0, artifacts_1.uploadArtifacts)();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ function findResultsJson(): string | null {
return null;
}

function writeDotEnvLocal(workspace: string, vars: Record<string, string>): void {
// The PHP library reads env vars through phpdotenv (Dotenv::createImmutable),
// which only picks up .env / .env.local files — NOT process env, unless PHP
// is built with variables_order including 'E' (rarely the case in CI).
// Writing .env.local (loaded before .env, values are immutable so they win)
// guarantees the lib sees our values regardless of PHP config.
const path = `${workspace}/.env.local`;
const body = Object.entries(vars).map(([k, v]) => `${k}=${v}`).join('\n') + '\n';
fs.writeFileSync(path, body);
core.info(`Wrote ${Object.keys(vars).length} vars to ${path}`);
}

export async function run(): Promise<void> {
let flashlight: FlashlightHandle | null = null;
let stepFailed = false;
Expand Down Expand Up @@ -55,6 +67,10 @@ export async function run(): Promise<void> {
flashlight = await startFlashlight({ composeYaml, port });
env.PRESTAFLOW_FO_URL = `${flashlight.url}/`;
env.PRESTAFLOW_PS_VERSION = inputs.psVersion;
writeDotEnvLocal(workspace, {
PRESTAFLOW_FO_URL: `${flashlight.url}/`,
PRESTAFLOW_PS_VERSION: inputs.psVersion,
});
core.info(`Flashlight ready at ${flashlight.url} (PS ${inputs.psVersion})`);
}

Expand Down Expand Up @@ -82,7 +98,17 @@ export async function run(): Promise<void> {
core.warning('No results.json found — outputs will be zeros.');
}

const uploaded = await uploadToApi({ token: inputs.token, projectId: inputs.projectId });
let uploaded = { id: '', url: '' };
if (resultsPath) {
try {
uploaded = await uploadToApi({ token: inputs.token, projectId: inputs.projectId });
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
core.warning(`API upload failed: ${msg}`);
}
} else {
core.info('Skipping API upload (no results.json to send).');
}

if (inputs.uploadArtifacts) {
await uploadArtifacts();
Expand Down
Loading