diff --git a/.github/changeset-preview/preview-changeset-versions.mjs b/.github/changeset-preview/preview-changeset-versions.mjs index 3f85842f..2569314c 100644 --- a/.github/changeset-preview/preview-changeset-versions.mjs +++ b/.github/changeset-preview/preview-changeset-versions.mjs @@ -89,11 +89,12 @@ function main() { const explicit = readChangesetEntries() if (explicit.size === 0) { - const msg = 'No changeset entries found — nothing to preview.\n' + const msg = + 'No changeset entries found. Merging this PR will not cause a version bump for any packages.\n' + process.stdout.write(msg) if (values.output) { writeFileSync(values.output, msg) - } else { - process.stdout.write(msg) + process.stdout.write(`Written to ${values.output}\n`) } return } @@ -138,12 +139,11 @@ function main() { // 7. Build markdown const lines = [] - lines.push('') - lines.push('## Changeset Version Preview') - lines.push('') if (bumps.length === 0) { - lines.push('No version changes detected.') + lines.push( + 'No version changes detected. Merging this PR will not cause a version bump for any packages.', + ) } else { const explicitBumps = bumps.filter((b) => b.source !== 'dependency') const dependencyBumps = bumps.filter((b) => b.source === 'dependency') @@ -184,13 +184,12 @@ function main() { } lines.push('') - const md = lines.join('\n') + + process.stdout.write(md) if (values.output) { writeFileSync(values.output, md) process.stdout.write(`Written to ${values.output}\n`) - } else { - process.stdout.write(md) } } diff --git a/.github/changeset-preview/upsert-pr-comment.mjs b/.github/changeset-preview/upsert-pr-comment.mjs index 9637e213..7d106302 100644 --- a/.github/changeset-preview/upsert-pr-comment.mjs +++ b/.github/changeset-preview/upsert-pr-comment.mjs @@ -4,7 +4,7 @@ import { promises as fsp } from 'node:fs' import path from 'node:path' import { parseArgs as parseNodeArgs } from 'node:util' -const DEFAULT_MARKER = '' +const DEFAULT_MARKER = '' function parseArgs(argv) { const { values } = parseNodeArgs({ @@ -109,9 +109,9 @@ async function main() { const args = parseArgs(process.argv.slice(2)) const bodyPath = path.resolve(args.bodyFile) const rawBody = await fsp.readFile(bodyPath, 'utf8') - const body = rawBody.includes(args.marker) - ? rawBody - : `${args.marker}\n${rawBody}` + const body = `${args.marker}\n## 🚀 Changeset Version Preview\n\n${rawBody}` + + process.stdout.write(body) const comments = await listIssueComments({ apiUrl: args.apiUrl, diff --git a/.github/workflows/changeset-preview.yml b/.github/workflows/changeset-preview.yml index 3eb706ed..125ea889 100644 --- a/.github/workflows/changeset-preview.yml +++ b/.github/workflows/changeset-preview.yml @@ -2,8 +2,6 @@ name: Changeset Preview on: pull_request: - paths: - - '.changeset/**' concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }}