mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-30 01:08:06 +00:00
710913e218
Renovate 44.0.0 was incorrectly released from #44004 due to the `BREAKING ...` reference in the commit message. Renovate uses Squash Merge as our method for merging commits into `main`, and when enabled with the Merge Queue[0], this doesn't provide maintainers with the ability to inspect the commit messages before merging (which would be the case if not using the Merge Queue, we would likely rewrite the commit message prior to merge. With this in mind, Renovate maintainers often don't inspect the commit messages, allowing them to stay as they are, as they'll be squashed into the final commit. In the case of #44004, this led to us missing the `BREAKING ...` trailing message - from changes that were split into #44939 - and because of this, semantic-release published this as a major release. As a means to prevent this happening again, we can introduce a CI check that performs a full `semantic-release --dry-run` programatically, so we can avoid relying on log lines from `semantic-release`. This then flags if there is a suggested major release, and if so, rejecting it. Co-authored-by: Claude Opus 4.8 (1M context) <jamie.tanna+claude-code@mend.io>
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import {
|
|
type DryRunResultLike,
|
|
evaluateResult,
|
|
} from './check-release-dry-run.ts';
|
|
|
|
function result(
|
|
nextType: string | null,
|
|
version = '0.0.0',
|
|
lastVersion: string | null = '44.0.0',
|
|
): DryRunResultLike | false {
|
|
return {
|
|
nextRelease: nextType ? { type: nextType, version } : null,
|
|
lastRelease: lastVersion ? { version: lastVersion } : null,
|
|
};
|
|
}
|
|
|
|
describe('tools/check-release-dry-run', () => {
|
|
describe('evaluateResult', () => {
|
|
it('flags a major release', () => {
|
|
expect(evaluateResult(result('major', '45.0.0'))).toEqual({
|
|
willRelease: true,
|
|
type: 'major',
|
|
version: '45.0.0',
|
|
lastVersion: '44.0.0',
|
|
isMajor: true,
|
|
});
|
|
});
|
|
|
|
it('flags a premajor release (next prerelease branch)', () => {
|
|
expect(evaluateResult(result('premajor', '45.0.0-next.1'))).toMatchObject(
|
|
{
|
|
isMajor: true,
|
|
},
|
|
);
|
|
});
|
|
|
|
it('does not flag a minor release', () => {
|
|
expect(evaluateResult(result('minor', '44.1.0'))).toMatchObject({
|
|
isMajor: false,
|
|
type: 'minor',
|
|
});
|
|
});
|
|
|
|
it('does not flag a patch release', () => {
|
|
expect(evaluateResult(result('patch', '44.0.1'))).toMatchObject({
|
|
isMajor: false,
|
|
});
|
|
});
|
|
|
|
it('handles no release (result is false)', () => {
|
|
expect(evaluateResult(false)).toEqual({
|
|
willRelease: false,
|
|
type: null,
|
|
version: null,
|
|
lastVersion: null,
|
|
isMajor: false,
|
|
});
|
|
});
|
|
|
|
it('handles no release (no nextRelease)', () => {
|
|
expect(evaluateResult(result(null))).toMatchObject({
|
|
willRelease: false,
|
|
isMajor: false,
|
|
});
|
|
});
|
|
});
|
|
});
|