Channel-aware `ci plan`: reports what `ci release` would do on this channel branch
(
rootDir: string,
config: BumpyConfig,
channel: ResolvedChannel,
packages: Map<string, import('../types.ts').WorkspacePackage>,
depGraph: DependencyGraph,
bumpFiles: BumpFile[],
)
| 1189 | |
| 1190 | /** Channel-aware `ci plan`: reports what `ci release` would do on this channel branch */ |
| 1191 | async function ciChannelPlan( |
| 1192 | rootDir: string, |
| 1193 | config: BumpyConfig, |
| 1194 | channel: ResolvedChannel, |
| 1195 | packages: Map<string, import('../types.ts').WorkspacePackage>, |
| 1196 | depGraph: DependencyGraph, |
| 1197 | bumpFiles: BumpFile[], |
| 1198 | ): Promise<void> { |
| 1199 | const pending = bumpFiles.filter((bf) => bf.channel !== channel.name); |
| 1200 | const movedIds = detectChannelMoves(rootDir, channel); |
| 1201 | |
| 1202 | let mode: CiPlanMode = 'nothing'; |
| 1203 | let releases: PlannedRelease[] = []; |
| 1204 | if (pending.length > 0 || movedIds.length > 0) { |
| 1205 | mode = pending.length > 0 ? 'version-pr' : 'publish'; |
| 1206 | const stablePlan = assembleReleasePlan(bumpFiles, packages, depGraph, config, { |
| 1207 | prereleasePreid: channel.preid, |
| 1208 | }); |
| 1209 | try { |
| 1210 | const built = await buildChannelReleasePlan(stablePlan, channel, packages, rootDir, { forDisplay: true }); |
| 1211 | releases = built.plan.releases; |
| 1212 | } catch { |
| 1213 | releases = stablePlan.releases.map((r) => ({ ...r, newVersion: `${r.newVersion}-${channel.preid}.?` })); |
| 1214 | } |
| 1215 | } |
| 1216 | |
| 1217 | const output = { |
| 1218 | mode, |
| 1219 | channel: channel.name, |
| 1220 | bumpFiles: bumpFiles.map((bf) => ({ |
| 1221 | id: bf.id, |
| 1222 | summary: bf.summary, |
| 1223 | releases: bf.releases.map((r) => ({ name: r.name, type: r.type })), |
| 1224 | shipped: bf.channel === channel.name, |
| 1225 | })), |
| 1226 | releases: releases.map((r) => formatPlanRelease(r, packages, config)), |
| 1227 | packageNames: releases.map((r) => r.name), |
| 1228 | }; |
| 1229 | |
| 1230 | const json = JSON.stringify(output, null, 2); |
| 1231 | console.log(json); |
| 1232 | writeGitHubOutput('mode', output.mode); |
| 1233 | writeGitHubOutput('channel', channel.name); |
| 1234 | writeGitHubOutput('packages', JSON.stringify(output.packageNames)); |
| 1235 | writeGitHubOutput('json', JSON.stringify(output)); |
| 1236 | } |
| 1237 | |
| 1238 | // ---- PR comment helpers ---- |
| 1239 |
no test coverage detected
searching dependent graphs…