Skip to content

Commit 820782c

Browse files
ci: always preview versions (#357)
* ci: always preview versions * Update comment wording * Add changeset * More testing * Update peerDep * Fix * Undo test changes
1 parent e6dd8de commit 820782c

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

.github/changeset-preview/preview-changeset-versions.mjs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ function main() {
8989
const explicit = readChangesetEntries()
9090

9191
if (explicit.size === 0) {
92-
const msg = 'No changeset entries found — nothing to preview.\n'
92+
const msg =
93+
'No changeset entries found. Merging this PR will not cause a version bump for any packages.\n'
94+
process.stdout.write(msg)
9395
if (values.output) {
9496
writeFileSync(values.output, msg)
95-
} else {
96-
process.stdout.write(msg)
97+
process.stdout.write(`Written to ${values.output}\n`)
9798
}
9899
return
99100
}
@@ -138,12 +139,11 @@ function main() {
138139

139140
// 7. Build markdown
140141
const lines = []
141-
lines.push('<!-- changeset-version-preview -->')
142-
lines.push('## Changeset Version Preview')
143-
lines.push('')
144142

145143
if (bumps.length === 0) {
146-
lines.push('No version changes detected.')
144+
lines.push(
145+
'No version changes detected. Merging this PR will not cause a version bump for any packages.',
146+
)
147147
} else {
148148
const explicitBumps = bumps.filter((b) => b.source !== 'dependency')
149149
const dependencyBumps = bumps.filter((b) => b.source === 'dependency')
@@ -184,13 +184,12 @@ function main() {
184184
}
185185

186186
lines.push('')
187-
188187
const md = lines.join('\n')
188+
189+
process.stdout.write(md)
189190
if (values.output) {
190191
writeFileSync(values.output, md)
191192
process.stdout.write(`Written to ${values.output}\n`)
192-
} else {
193-
process.stdout.write(md)
194193
}
195194
}
196195

.github/changeset-preview/upsert-pr-comment.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { promises as fsp } from 'node:fs'
44
import path from 'node:path'
55
import { parseArgs as parseNodeArgs } from 'node:util'
66

7-
const DEFAULT_MARKER = '<!-- bundle-size-benchmark -->'
7+
const DEFAULT_MARKER = '<!-- changeset-version-preview -->'
88

99
function parseArgs(argv) {
1010
const { values } = parseNodeArgs({
@@ -109,9 +109,9 @@ async function main() {
109109
const args = parseArgs(process.argv.slice(2))
110110
const bodyPath = path.resolve(args.bodyFile)
111111
const rawBody = await fsp.readFile(bodyPath, 'utf8')
112-
const body = rawBody.includes(args.marker)
113-
? rawBody
114-
: `${args.marker}\n${rawBody}`
112+
const body = `${args.marker}\n## 🚀 Changeset Version Preview\n\n${rawBody}`
113+
114+
process.stdout.write(body)
115115

116116
const comments = await listIssueComments({
117117
apiUrl: args.apiUrl,

.github/workflows/changeset-preview.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Changeset Preview
22

33
on:
44
pull_request:
5-
paths:
6-
- '.changeset/**'
75

86
concurrency:
97
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}

0 commit comments

Comments
 (0)