Skip to content

Commit 01bf7e3

Browse files
committed
docs(scripts): add JSDoc to enhance-release-pr.mjs new/changed functions
1 parent 34ee294 commit 01bf7e3

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

scripts/enhance-release-pr.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,17 @@ function parseFrontmatter(content) {
206206

207207
// --- Format the enhanced PR body ---
208208

209+
/**
210+
* Render the enhanced release PR body.
211+
*
212+
* @param {object} args
213+
* @param {string} args.version - Proposed release version (e.g. "4.4.6").
214+
* @param {Array<{text: string, type: string}>} args.packageEntries - Entries parsed from the changesets-generated PR body.
215+
* @param {Array<{text: string, type: string, area: string}>} args.serverEntries - Entries parsed from .server-changes/*.md.
216+
* @param {string} args.rawBody - The original changesets-generated PR body (kept in a collapsed details section).
217+
* @param {{sourceBranch: string, currentLatest: string, willBeLatest: boolean, lineMatch: string|null}|null} args.releaseContext - Release-branch context (only set when SOURCE_BRANCH env is present); drives the "Release prep" header.
218+
* @returns {string} Markdown body.
219+
*/
209220
function formatPrBody({ version, packageEntries, serverEntries, rawBody, releaseContext }) {
210221
const lines = [];
211222

@@ -340,6 +351,17 @@ function formatPrBody({ version, packageEntries, serverEntries, rawBody, release
340351

341352
// --- Main ---
342353

354+
/**
355+
* Build release-branch context for the PR body header.
356+
*
357+
* Reads SOURCE_BRANCH from the environment (set by changesets-pr.yml). When
358+
* present, queries npm for the current `latest` dist-tag of @trigger.dev/sdk,
359+
* compares the proposed version against it, and returns context for rendering
360+
* the "Release prep" header. Returns null when SOURCE_BRANCH is unset (so the
361+
* header is omitted on plain main releases that don't need branch context).
362+
*
363+
* @returns {Promise<{sourceBranch: string, currentLatest: string, willBeLatest: boolean, lineMatch: string|null}|null>}
364+
*/
343365
async function getReleaseContext() {
344366
const sourceBranch = process.env.SOURCE_BRANCH;
345367
if (!sourceBranch) return null;

0 commit comments

Comments
 (0)