Skip to content

Commit 2cfe87d

Browse files
kristof-siketclaude
andcommitted
fix: default urls to {} on every exit; keep job-summary write non-fatal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1176fd2 commit 2cfe87d

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ The credential resolves in order: an explicit `PRISMA_SERVICE_TOKEN` from the en
105105
| `outcome` | `succeeded`, `failed`, or `skipped-no-credential` |
106106
| `build-id` | The build id assigned by the Prisma API when reporting is active. Holds a stable placeholder value when the run has no credential, so downstream steps always receive a value. |
107107
| `url` | After a deploy, the public URL of the app's root service (the service declared in the root module, e.g. `app`). Empty when the deploy exposed no service. |
108-
| `urls` | After a deploy, a JSON object mapping every deployed service's Composer address to its public URL, e.g. `{"app":"https://….prisma.build","login.service":"https://…"}`. `{}` otherwise. |
108+
| `urls` | After a deploy, a JSON object mapping every deployed service's Composer address to its public URL, e.g. `{"app":"https://….prisma.build","login.service":"https://…"}`. `{}` on every other outcome (skipped, failed, destroy). |
109109

110-
A deploy also lists every service URL in the job summary. To get a "View deployment" button on pull requests, point the job's environment at the `url` output:
110+
When the CLI prints its structured deploy result, the job summary also lists every service URL. To get a "View deployment" button on pull requests, point the job's environment at the `url` output:
111111

112112
```yaml
113113
deploy:

‎main.mjs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const branch = process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || "";
114114
const runUrl = `${process.env.GITHUB_SERVER_URL ?? "https://github.com"}/${repository}/actions/runs/${process.env.GITHUB_RUN_ID}`;
115115

116116
log(`prisma-deploy: mode=${mode} module=${modulePath} working-directory=${workdir}`);
117+
// Every exit path leaves valid JSON for fromJSON(); a deploy overwrites it (last write wins).
118+
setOutput("urls", "{}");
117119

118120
if (mode !== "deploy" && mode !== "destroy") {
119121
failEarly("config", `unknown mode "${mode}" (expected "deploy" or "destroy")`);
@@ -286,10 +288,14 @@ if (mode === "deploy") {
286288
const rows = Object.entries(urls).map(([address, u]) => `| \`${address}\` | ${u} |`);
287289
if (rows.length > 0 && process.env.GITHUB_STEP_SUMMARY) {
288290
const target = stage ? `stage \`${stage}\`` : "production";
289-
appendFileSync(
290-
process.env.GITHUB_STEP_SUMMARY,
291-
`### Deployed to ${target}\n\n| Service | URL |\n| --- | --- |\n${rows.join("\n")}\n`,
292-
);
291+
try {
292+
appendFileSync(
293+
process.env.GITHUB_STEP_SUMMARY,
294+
`### Deployed to ${target}\n\n| Service | URL |\n| --- | --- |\n${rows.join("\n")}\n`,
295+
);
296+
} catch (error) {
297+
log(`::warning::could not write the job summary: ${error.message}`);
298+
}
293299
}
294300
}
295301

0 commit comments

Comments
 (0)