[ci] version_check_command now checks markdown of first CHANGELOG line. (#7266)

This PR:

* Modifies the `version_check_command` test so it checks the leading markdown of the first line of a CHANGELOG file, to ensure it's `'##'`.
* Fixes the CHANGELOG in two packages that were allowed by the tool before this fix:
  * google_maps_flutter_web
  * interactive_media_ads

## Issues

Fixes https://github.com/flutter/flutter/issues/152638
This commit is contained in:
David Iglesias
2024-07-31 18:33:18 -07:00
committed by GitHub
parent 37c4b1cd75
commit f8fbcdbe95
8 changed files with 54 additions and 7 deletions

View File

@ -641,6 +641,41 @@ void main() {
);
});
test('fails gracefully if the first entry uses the wrong style', () async {
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, version: '1.0.0');
const String changelog = '''
# 1.0.0
* Some changes for a later release.
## 0.9.0
* Some earlier changes.
''';
plugin.changelogFile.writeAsStringSync(changelog);
processRunner.mockProcessesForExecutable['git-show'] = <FakeProcessInfo>[
FakeProcessInfo(MockProcess(stdout: 'version: 1.0.0')),
];
Error? commandError;
final List<String> output = await runCapturingPrint(runner, <String>[
'version-check',
'--base-sha=main',
], errorHandler: (Error e) {
commandError = e;
});
expect(commandError, isA<ToolExit>());
expect(
output,
containsAllInOrder(<Matcher>[
contains('Unable to find a version in CHANGELOG.md'),
contains('The current version should be on a line starting with '
'"## ", either on the first non-empty line or after a "## NEXT" '
'section.'),
]),
);
});
test(
'fails gracefully if the version headers are not found due to using the wrong style',
() async {