Skip to content

Commit b7936da

Browse files
AddonoCopilot
andcommitted
fix: throw on missing download URL; suppress ExperimentalWarning
- releaseAsset: if browser_download_url is absent after a successful upload (e.g. when the target repo has been renamed and the git remote still points to the old name), throw UploadError(MISSING_DOWNLOAD_URL) with a hint to use the full owner/repo#N target format instead of silently returning 'undefined' in the markdown output. - cli/index: suppress Node's ExperimentalWarning for the Fetch API (emitted on Node < 21) so it doesn't pollute stdout/stderr. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 679fa09 commit b7936da

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/cli/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
* CLI can be imported and tested without triggering `program.parse()`.
66
*/
77

8+
// Suppress ExperimentalWarning for the Fetch API (emitted on Node < 21).
9+
process.removeAllListeners("warning");
10+
process.on("warning", (warning) => {
11+
if (warning.name === "ExperimentalWarning") return;
12+
process.stderr.write(`${warning.stack ?? warning.message}\n`);
13+
});
14+
815
import { readFileSync } from "fs";
916
import { dirname, resolve } from "path";
1017
import { fileURLToPath } from "url";

src/core/strategies/releaseAsset.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,15 @@ async function uploadAsset(
304304
},
305305
});
306306

307+
if (!asset.browser_download_url) {
308+
throw new UploadError(
309+
"Upload succeeded but no download URL was returned by GitHub. " +
310+
"The target repository may have been renamed — use the full owner/repo#N target format.",
311+
"MISSING_DOWNLOAD_URL",
312+
{ filePath, target },
313+
);
314+
}
315+
307316
return asset.browser_download_url;
308317
} catch (err: unknown) {
309318
const status = getHttpStatus(err);

0 commit comments

Comments
 (0)