Skip to content

Commit a63ce40

Browse files
rochdevclaude
authored andcommitted
chore(release): replace semver-major exclusion with only-land-on-next label (#8660)
semver-major commits are now cherry-picked into stable release proposals (treated as patches, gated behind a flag) but excluded from release notes. The new `only-land-on-next` label replaces the old per-version `dont-land-on-vN.x` labels to mark commits that should only land on the next major release line (master) and not on any current stable line. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 79ca222 commit a63ce40

4 files changed

Lines changed: 25 additions & 19 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ In the event that some existing functionality _does_ need to change, as much as
7171

7272
## Indicate intended release targets
7373

74-
When writing major changes we use a series of labels in the form of `dont-land-on-vN.x` where N is the major release line which a PR should not land in. Every PR marked as semver-major should include these tags. These tags allow our [branch-diff](https://github.com/bengl/branch-diff) tooling to work smoothly as we can exclude PRs not intended for the release line we're preparing a release proposal for. The `semver-major` labels on their own are not sufficient as they don't encode any indication of from _which_ releases they are a major change.
74+
When writing changes that should only land on the next major release line (master) and not on any current stable release line, add the `only-land-on-next` label. This tells our [branch-diff](https://github.com/bengl/branch-diff) tooling to exclude those PRs when preparing a release proposal for a stable line.
7575

76-
For outside contributions we will have the relevant team add these labels when they review and determine when they plan to release it.
76+
For outside contributions we will have the relevant team add this label when they review and determine the intended release target.
7777

7878
## Ensure all tests are green
7979

scripts/check-proposal-labels.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ const childProcess = require('child_process')
66
const ORIGIN = 'origin/'
77

88
let releaseBranch = process.env.GITHUB_BASE_REF // 'origin/v3.x'
9-
let releaseVersion = releaseBranch
10-
if (releaseBranch.startsWith(ORIGIN)) {
11-
releaseVersion = releaseBranch.slice(ORIGIN.length)
12-
} else {
9+
if (!releaseBranch.startsWith(ORIGIN)) {
1310
releaseBranch = ORIGIN + releaseBranch
1411
}
15-
let currentBranch = process.env.GITHUB_HEAD_REF // 'ugaitz/workflow-to-verify-dont-land-on-v3.x'
12+
let currentBranch = process.env.GITHUB_HEAD_REF
1613
if (!currentBranch.startsWith(ORIGIN)) {
1714
currentBranch = ORIGIN + currentBranch
1815
}
1916

20-
const getHashesCommandWithExclusions = 'branch-diff --user DataDog --repo dd-trace-js --exclude-label=semver-major' +
21-
` --exclude-label=dont-land-on-${releaseVersion} ${releaseBranch} ${currentBranch}`
17+
const getHashesCommandWithExclusions =
18+
`branch-diff --user DataDog --repo dd-trace-js --exclude-label=only-land-on-next ${releaseBranch} ${currentBranch}`
2219
const getHashesCommandWithoutExclusions =
2320
`branch-diff --user DataDog --repo dd-trace-js ${releaseBranch} ${currentBranch}`
2421

scripts/release/proposal.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,26 @@ try {
6666

6767
pass(`v${releaseLine}.x`)
6868

69-
const diffCmd = 'branch-diff --user DataDog --repo dd-trace-js --exclude-label=semver-major'
69+
// Notes exclude semver-major (gated behind a flag, not user-visible).
70+
// Cherry-pick includes semver-major; only only-land-on-next is fully excluded.
71+
const notesDiffCmd = 'branch-diff --user DataDog --repo dd-trace-js' +
72+
' --exclude-label=semver-major --exclude-label=only-land-on-next'
73+
const cherryPickDiffCmd = 'branch-diff --user DataDog --repo dd-trace-js' +
74+
' --exclude-label=only-land-on-next'
7075

7176
start('Determine version increment')
7277

7378
const { DD_MAJOR, DD_MINOR, DD_PATCH } = require('../../version')
74-
const lineDiff = capture(`${diffCmd} --format=markdown v${releaseLine}.x ${main}`)
75-
76-
// Only commits with a semver-patch/minor label warrant cutting a release;
77-
// unlabeled commits (e.g. docs/chore) ride along in the notes and the
78-
// cherry-pick, but are not enough on their own.
79-
if (!lineDiff.includes('SEMVER-MINOR') && !lineDiff.includes('SEMVER-PATCH')) {
79+
const lineDiff = capture(`${notesDiffCmd} --format=markdown v${releaseLine}.x ${main}`)
80+
const allDiff = capture(`${cherryPickDiffCmd} --format=markdown v${releaseLine}.x ${main}`)
81+
82+
// Only labeled commits (semver-patch/minor/major) warrant cutting a release;
83+
// unlabeled commits (e.g. docs/chore) ride along but are not enough on their own.
84+
if (
85+
!allDiff.includes('SEMVER-MINOR') &&
86+
!allDiff.includes('SEMVER-PATCH') &&
87+
!allDiff.includes('SEMVER-MAJOR')
88+
) {
8089
pass('none (already up to date)')
8190
process.exit(0)
8291
}
@@ -110,12 +119,12 @@ try {
110119

111120
// Get the hashes of the last version and the commits to add.
112121
const lastCommit = capture('git log -1 --pretty=%B')
113-
const proposalDiff = capture(`${diffCmd} --format=sha --reverse v${newVersion}-proposal ${main}`)
122+
const proposalDiff = capture(`${cherryPickDiffCmd} --format=sha --reverse v${newVersion}-proposal ${main}`)
114123
.replaceAll('\n', ' ').trim()
115124

116125
if (proposalDiff) {
117126
// Get new changes since last commit of the proposal branch.
118-
const newChanges = capture(`${diffCmd} v${newVersion}-proposal ${main}`)
127+
const newChanges = capture(`${cherryPickDiffCmd} v${newVersion}-proposal ${main}`)
119128

120129
pass(`\n${newChanges}`)
121130

scripts/release/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ try {
5858

5959
pass()
6060

61-
const diffCmd = 'branch-diff --user DataDog --repo dd-trace-js --exclude-label=semver-major'
61+
const diffCmd = 'branch-diff --user DataDog --repo dd-trace-js --exclude-label=only-land-on-next'
6262

6363
start('Validate differences between proposal and main branch.')
6464

0 commit comments

Comments
 (0)