Skip to content

Commit a574750

Browse files
authored
ci: reduce releaser log noise (3.x) (#18982)
Ports [#18842](#18842) from main to 3.x. It removes two noisy releaser log lines that appeared in the v3.92.0 release run. ```text Before: 🚀 @payloadcms/richtext-lexical publishing... 📦 @payloadcms/[email protected] → https://registry.npmjs.org/ ✅ Published package @payloadcms/[email protected] ✅ @payloadcms/richtext-lexical published ⚠️ v3.92.0 not found in the 100 most recent releases; treating it as new. A draft buried deeper in the history would not be updated. After: 🚀 @payloadcms/richtext-lexical publishing... 📦 @payloadcms/[email protected] → https://registry.npmjs.org/ ✅ Published package @payloadcms/[email protected] ``` ## Root Cause - The draft-release lookup scans only the newest page of 100 releases. The repo has more than 100 releases. The page is always full. The warning fired for every new tag. - The releaser streams `pnpm publish` output live. pnpm 11 prints its own `✅ Published package` line. The releaser then printed a second success line. ## Changes - **Draft release lookup** - Removes the "not found in the 100 most recent releases" warning. - Logs `Found existing draft release for <tag>; updating it.` when it updates an existing draft. - **Publish output** - Removes the releaser's own success lines, including the `(on retry)` variant. The `Retrying publish` line before it already shows the retry. 🤖 Written with AI
1 parent 51fd560 commit a574750

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎tools/releaser/src/lib/getWorkspace.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ export async function publishSinglePackage(
187187

188188
const { exitCode, output } = await runPnpm(cmdArgs)
189189

190+
// pnpm's streamed output already reports the successful publish
190191
if (exitCode === 0) {
191-
console.log(`✅ ${pkg.name} published`)
192192
return { name: pkg.name, success: true }
193193
}
194194

@@ -205,7 +205,6 @@ export async function publishSinglePackage(
205205
const { exitCode: retryExitCode, output: retryOutput } = await runPnpm(cmdArgs)
206206

207207
if (retryExitCode === 0) {
208-
console.log(`✅ ${pkg.name} published (on retry)`)
209208
return { name: pkg.name, success: true }
210209
}
211210

‎tools/releaser/src/utils/createDraftGitHubRelease.spec.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe('createDraftGitHubRelease', () => {
5454
})
5555

5656
it('should PATCH an existing draft release found by tag_name', async () => {
57+
const log = vi.spyOn(console, 'log').mockImplementation(() => {})
5758
const fetchImpl = vi
5859
.fn()
5960
.mockResolvedValueOnce(
@@ -75,6 +76,9 @@ describe('createDraftGitHubRelease', () => {
7576
const patchCall = fetchImpl.mock.calls.at(-1)!
7677
expect(patchCall[0]).toContain('/releases/42')
7778
expect(patchCall[1].method).toBe('PATCH')
79+
expect(log).toHaveBeenCalledWith(expect.stringContaining('existing draft release'))
80+
81+
log.mockRestore()
7882
})
7983

8084
it('should send make_latest false in the POST body when makeLatest is false', async () => {
@@ -166,13 +170,14 @@ describe('createDraftGitHubRelease', () => {
166170
expect(fetchImpl).toHaveBeenCalledTimes(1)
167171
})
168172

169-
it('should scan only the newest page and treat a not-found tag as new (with a warning)', async () => {
173+
it('should scan only the newest page and silently treat a not-found tag as new', async () => {
170174
const fullPage = Array.from({ length: 100 }, (_, i) => ({
171175
id: i,
172176
draft: true,
173177
tag_name: `v4.0.0-canary.${i}`,
174178
}))
175179
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
180+
const log = vi.spyOn(console, 'log').mockImplementation(() => {})
176181
const fetchImpl = vi
177182
.fn()
178183
.mockResolvedValueOnce(jsonResponse(fullPage)) // page 1: 100 items, target absent
@@ -191,8 +196,10 @@ describe('createDraftGitHubRelease', () => {
191196
expect(fetchImpl).toHaveBeenCalledTimes(2)
192197
expect(fetchImpl.mock.calls[0]![0]).toContain('page=1')
193198
expect(fetchImpl.mock.calls.at(-1)![1].method).toBe('POST')
194-
expect(warn).toHaveBeenCalled()
199+
expect(warn).not.toHaveBeenCalled()
200+
expect(log).not.toHaveBeenCalled()
195201

196202
warn.mockRestore()
203+
log.mockRestore()
197204
})
198205
})

‎tools/releaser/src/utils/createDraftGitHubRelease.ts‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export const createDraftGitHubRelease = async ({
4343
)
4444
}
4545

46+
if (existing) {
47+
console.log(`📝 Found existing draft release for ${tag}; updating it.`)
48+
}
49+
4650
// https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28
4751
const url = existing
4852
? `https://api.github.com/repos/${REPO}/releases/${existing.id}`
@@ -87,8 +91,7 @@ export const createDraftGitHubRelease = async ({
8791
// instead. The list is newest-first by created_at and a draft we would update was
8892
// created recently, so it sits on the first page — we scan only the newest page to
8993
// stay O(1) as the release history grows. A match buried deeper would require ~100
90-
// releases created after the draft (implausible for a re-run); we warn if that
91-
// near-impossible case is even reachable.
94+
// releases created after the draft, which is implausible for a re-run.
9295
const findReleaseByTag = async ({
9396
fetchImpl,
9497
tag,
@@ -112,13 +115,5 @@ const findReleaseByTag = async ({
112115
}
113116

114117
const releases = (await res.json()) as GitHubRelease[]
115-
const match = releases.find((release) => release.tag_name === tag)
116-
117-
if (!match && releases.length === PER_PAGE) {
118-
console.warn(
119-
`⚠️ ${tag} not found in the ${PER_PAGE} most recent releases; treating it as new. A draft buried deeper in the history would not be updated.`,
120-
)
121-
}
122-
123-
return match
118+
return releases.find((release) => release.tag_name === tag)
124119
}

0 commit comments

Comments
 (0)