Skip to content

Commit e5f0b32

Browse files
authored
chore: remove release dates from cli/CHANGELOG.md (#33603)
1 parent ec14995 commit e5f0b32

7 files changed

Lines changed: 101 additions & 234 deletions

File tree

cli/CHANGELOG.md

Lines changed: 1 addition & 196 deletions
Large diffs are not rendered by default.

guides/release-process.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ _Note: It is advisable to notify the team that the `develop` branch is locked do
143143
144144
11. Review the release-specific documentation and changelog PR in [cypress-documentation](https://github.com/cypress-io/cypress-documentation). If there is not already a release-specific PR open, create one.
145145
- Copy the changelog content for this version from the release PR above into `/docs/app/references/changelog.mdx`. Adjust any `docs.cypress.io` links to use host-relative paths.
146+
- Add the release date in `_Released MM/DD/YYYY_` format below the version header in the `changelog.mdx` entry.
146147
- Merge any release-specific documentation changes into the main release PR.
147148
- You can view the doc's [branch deploy preview](https://github.com/cypress-io/cypress-documentation/blob/master/CONTRIBUTING.md#pull-requests) by clicking 'Details' on the PR's `netlify-cypress-docs/deploy-preview` GitHub status check.
148149

guides/writing-the-cypress-changelog.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@ The changelog should include anything that was merged into the `develop` branch
2020
```md
2121
## <RELEASE_VERSION>
2222

23-
_Released <RELEASE_DATE> (PENDING)_
24-
2523
**<CHANGE_SECTION:**
2624

2725
- <CHANGELOG_ENTRY>
2826
```
2927

30-
The `RELEASE_DATE` follows the `Mon D, YYYY` format (three-letter month abbreviation, non-zero-padded day, four-digit year).
31-
3228
2. Each changelog entry is written and merged with the associated user-facing code change in [`cli/CHANGELOG.md`](../cli/CHANGELOG.md).
3329
3. The changelog entry should be added to the associated change section. The supported change sections for the changelog (that should be listed in the order below) are:
3430

@@ -75,7 +71,6 @@ No backticks for:
7571
## Release
7672

7773
At the time of the release, the releaser will:
78-
- remove the `(PENDING)` text next to the planned release date and adjust the date if needed
7974
- ensure the Changelog is coherent
8075
- ensure the change sections are in the correct order
8176
- ensure that the entries are ordered by impact

scripts/semantic-commits/parse-changelog.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path')
33
const { userFacingChanges } = require('./change-categories')
44
const userFacingSections = Object.values(userFacingChanges).map(({ section }) => section)
55

6-
async function parseChangelog ({ pendingRelease = true, changelogContent = null } = {}) {
6+
async function parseChangelog ({ changelogContent = null } = {}) {
77
const changelog = changelogContent || fs.readFileSync(path.join(__dirname, '..', '..', 'cli', 'CHANGELOG.md'), 'utf8')
88
const changeLogLines = changelog.split('\n')
99

@@ -36,15 +36,6 @@ async function parseChangelog ({ pendingRelease = true, changelogContent = null
3636
}
3737

3838
sections['version'] = line
39-
} else if (index === 3) {
40-
nextKnownLineBreak = index + 1
41-
if (pendingRelease && !/_Released [A-Z][a-z]{2} ([1-9]|[12]\d|3[01]), \d{4} \(PENDING\)_/.test(line)) {
42-
throw new Error(`Expected line number ${index + 1} to include "_Released Mon D, YYYY (PENDING)_"`)
43-
} else if (!pendingRelease && !/_Released [A-Z][a-z]{2} ([1-9]|[12]\d|3[01]), \d{4}_/.test(line)) {
44-
throw new Error(`Expected line number ${index + 1} to include "_Released Mon D, YYYY_"`)
45-
}
46-
47-
sections['releaseDate'] = line
4839
} else if (index === nextKnownLineBreak) {
4940
if (line !== '') {
5041
throw new Error(`Expected line number ${index + 1} to be a line break`)

scripts/semantic-commits/validate-binary-changelog.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const changelog = async () => {
4040
return validateChangelog({
4141
nextVersion,
4242
changedFiles,
43-
pendingRelease: !hasVersionBump,
4443
commits,
4544
})
4645
}

scripts/semantic-commits/validate-changelog.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const _handleErrors = (errors) => {
129129
* environment variable in CircleCI to a branch or comma-separated list of
130130
* branches
131131
*/
132-
async function validateChangelog ({ changedFiles, nextVersion, pendingRelease, commits, changelogContent }) {
132+
async function validateChangelog ({ changedFiles, nextVersion, commits, changelogContent }) {
133133
if (process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES) {
134134
const branches = process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES.split(',')
135135

@@ -140,7 +140,23 @@ async function validateChangelog ({ changedFiles, nextVersion, pendingRelease, c
140140
}
141141
}
142142

143-
const hasUserFacingCommits = commits.some(({ semanticType }) => hasUserFacingChange(semanticType))
143+
// Build a set of PR numbers that were reverted within this release window so
144+
// they can be excluded from changelog validation — a reverted commit should
145+
// not appear in the changelog since the change never shipped to users.
146+
const revertedPRNumbers = new Set()
147+
148+
commits.forEach(({ commitMessage }) => {
149+
// Revert messages look like: revert: "fix: something (#33512)" (#33611)
150+
const match = commitMessage && commitMessage.match(/revert.*\(#(\d+)\)"/i)
151+
152+
if (match) {
153+
revertedPRNumbers.add(String(match[1]))
154+
}
155+
})
156+
157+
const nonRevertedCommits = commits.filter(({ prNumber }) => !revertedPRNumbers.has(String(prNumber)))
158+
159+
const hasUserFacingCommits = nonRevertedCommits.some(({ semanticType }) => hasUserFacingChange(semanticType))
144160

145161
if (!hasUserFacingCommits) {
146162
console.log('Does not contain any user-facing changes that impact the next Cypress release.')
@@ -164,20 +180,20 @@ async function validateChangelog ({ changedFiles, nextVersion, pendingRelease, c
164180
if (!hasChangeLogUpdate) {
165181
errors.push(`A changelog entry was not found in cli/CHANGELOG.md.`)
166182

167-
if (commits.length === 1) {
168-
errors.push(`Please add a changelog entry that describes the changes. Include this entry under the section:\n\n${_printChangeLogExample(commits[0].semanticType, commits[0].prNumber, commits[0].associatedIssues)}`)
183+
if (nonRevertedCommits.length === 1) {
184+
errors.push(`Please add a changelog entry that describes the changes. Include this entry under the section:\n\n${_printChangeLogExample(nonRevertedCommits[0].semanticType, nonRevertedCommits[0].prNumber, nonRevertedCommits[0].associatedIssues)}`)
169185

170186
return _handleErrors(errors)
171187
}
172188
}
173189

174-
const changelog = await parseChangelog({ pendingRelease, changelogContent })
190+
const changelog = await parseChangelog({ changelogContent })
175191

176192
if (nextVersion && !changelog.version === `## ${nextVersion}`) {
177193
errors.push(`The changelog version does not contain the next Cypress version of ${nextVersion}. If the changelog version is correct, please correct the pull request title to correctly reflect the change being made.`)
178194
}
179195

180-
commits.forEach(({ commitMessage, semanticType, prNumber, associatedIssues }) => {
196+
nonRevertedCommits.forEach(({ commitMessage, semanticType, prNumber, associatedIssues }) => {
181197
if (!Object.keys(userFacingChanges).includes(semanticType)) {
182198
return
183199
}

scripts/unit/semantic-commits/validate-changelog-spec.js

Lines changed: 76 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ describe('semantic-pull-request/validate-changelog', () => {
143143
fs.readFileSync.returns(`
144144
## 120.2.0
145145
146-
_Released Jan 7, 2033 (PENDING)_
147-
148146
**Performance:**
149147
150148
- Fixed in [#77](https://github.com/cypress-io/cypress/pull/77).`)
@@ -169,8 +167,6 @@ _Released Jan 7, 2033 (PENDING)_
169167
const changelogContent = `
170168
## 120.2.0
171169
172-
_Released Jan 7, 2033 (PENDING)_
173-
174170
**Performance:**
175171
176172
- Fixed in [#77](https://github.com/cypress-io/cypress/pull/77).`
@@ -196,8 +192,6 @@ _Released Jan 7, 2033 (PENDING)_
196192
fs.readFileSync.returns(`
197193
## 120.2.0
198194
199-
_Released Jan 7, 2033 (PENDING)_
200-
201195
**Misc:**
202196
203197
- Addresses [#77](https://github.com/cypress-io/cypress/issues/77) and [#88](https://github.com/cypress-io/cypress/issues/88).`)
@@ -253,6 +247,82 @@ _Released Jan 7, 2033 (PENDING)_
253247
expect(console.log).to.be.calledWith('Does not contain changes that impact the next Cypress release.')
254248
})
255249

250+
it('when a user-facing commit was reverted within the same release (conventional revert: style)', async () => {
251+
const changedFiles = [
252+
'packages/driver/lib/index.js',
253+
'cli/CHANGELOG.md',
254+
]
255+
256+
fs.readFileSync.returns(`
257+
## 120.2.0
258+
259+
**Performance:**
260+
261+
- Fixed in [#77](https://github.com/cypress-io/cypress/pull/77).`)
262+
263+
await validateChangelog({
264+
changedFiles,
265+
commits: [
266+
{
267+
commitMessage: 'perf: do something faster (#77)',
268+
prNumber: 77,
269+
semanticType: 'perf',
270+
},
271+
{
272+
commitMessage: 'fix: a bug (#88)',
273+
prNumber: 88,
274+
semanticType: 'fix',
275+
},
276+
{
277+
// conventional-commits lowercase revert style
278+
commitMessage: 'revert: "fix: a bug (#88)" (#99)',
279+
prNumber: 99,
280+
semanticType: 'revert',
281+
},
282+
],
283+
})
284+
285+
expect(console.log).to.be.calledWith('It appears at a high-level your changelog entry is correct! The remaining validation is left to the pull request reviewers.')
286+
})
287+
288+
it('when a user-facing commit was reverted within the same release (GitHub Revert style)', async () => {
289+
const changedFiles = [
290+
'packages/driver/lib/index.js',
291+
'cli/CHANGELOG.md',
292+
]
293+
294+
fs.readFileSync.returns(`
295+
## 120.2.0
296+
297+
**Performance:**
298+
299+
- Fixed in [#77](https://github.com/cypress-io/cypress/pull/77).`)
300+
301+
await validateChangelog({
302+
changedFiles,
303+
commits: [
304+
{
305+
commitMessage: 'perf: do something faster (#77)',
306+
prNumber: 77,
307+
semanticType: 'perf',
308+
},
309+
{
310+
commitMessage: 'fix: a bug (#88)',
311+
prNumber: '88',
312+
semanticType: 'fix',
313+
},
314+
{
315+
// GitHub UI uppercase Revert style; prNumber as string (from parser)
316+
commitMessage: 'Revert "fix: a bug (#88)" (#99)',
317+
prNumber: 99,
318+
semanticType: 'revert',
319+
},
320+
],
321+
})
322+
323+
expect(console.log).to.be.calledWith('It appears at a high-level your changelog entry is correct! The remaining validation is left to the pull request reviewers.')
324+
})
325+
256326
it('when current branch is in SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES env var', async () => {
257327
process.env.CIRCLE_BRANCH = 'this-branch'
258328
process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES = 'this-branch,that-branch'
@@ -283,8 +353,6 @@ _Released Jan 7, 2033 (PENDING)_
283353
fs.readFileSync.returns(`
284354
## 120.2.0
285355
286-
_Released Jan 7, 2033 (PENDING)_
287-
288356
`)
289357

290358
return validateChangelog({
@@ -310,8 +378,6 @@ _Released Jan 7, 2033 (PENDING)_
310378
fs.readFileSync.returns(`
311379
## 120.2.0
312380
313-
_Released Jan 7, 2033 (PENDING)_
314-
315381
**Features:**
316382
317383
- Addresses [#75](https://github.com/cypress-io/cypress/issues/75).`)
@@ -339,8 +405,6 @@ _Released Jan 7, 2033 (PENDING)_
339405
fs.readFileSync.returns(`
340406
## 120.2.0
341407
342-
_Released Jan 7, 2033 (PENDING)_
343-
344408
**Performance:**
345409
346410
- Some other update already added & vetted. Addresses [#32](https://github.com/cypress-io/cypress/issues/32).
@@ -372,8 +436,6 @@ _Released Jan 7, 2033 (PENDING)_
372436
fs.readFileSync.returns(`
373437
## 120.2.0
374438
375-
_Released Jan 7, 2033 (PENDING)_
376-
377439
**Performance:**
378440
379441
- comment without link.`)
@@ -401,8 +463,6 @@ _Released Jan 7, 2033 (PENDING)_
401463
fs.readFileSync.returns(`
402464
## 120.2.0
403465
404-
_Released Jan 7, 2033 (PENDING)_
405-
406466
**Performance:**
407467
408468
- comment without link.`)

0 commit comments

Comments
 (0)