Skip to content

Commit 117bf63

Browse files
authored
[ci] Add update-release-info command suggestion when version check fails (#9834)
When the version and CHANGELOG updates are missing, suggest the helpful `update-release-info` command. Log showing this in action: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8706431147753704257/+/u/Run_package_tests/CHANGELOG_and_version_validation/stdout ``` No version change found, but the change to this package could not be verified to be exempt from version changes according to repository policy. If this is a false positive, please comment in the PR to explain why the PR is exempt, and add (or ask your reviewer to add) the "override: no versioning needed" label. No CHANGELOG change found. If this PR needs an exemption from the standard policy of listing all changes in the CHANGELOG, comment in the PR to explain why the PR is exempt, and add (or ask your reviewer to add) the "override: no changelog needed" label. Otherwise, please add a NEXT entry in the CHANGELOG as described in the contributing guide. If this PR is not exempt, you may update the version and CHANGELOG with the "update-release-info" command. Example: $ dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ --version=minimal \ --base-branch=upstream/main \ --changelog="Description of the change." ``` ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 2fe85dd commit 117bf63

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

script/tool/lib/src/version_check_command.dart

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,20 +547,22 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog.
547547
return null;
548548
}
549549

550+
bool missingVersionChange = false;
551+
bool missingChangelogChange = false;
550552
if (state.needsVersionChange) {
551553
if (_prLabels.contains(_missingVersionChangeOverrideLabel)) {
552554
logWarning('Ignoring lack of version change due to the '
553555
'"$_missingVersionChangeOverrideLabel" label.');
554556
} else {
557+
missingVersionChange = true;
555558
printError(
556559
'No version change found, but the change to this package could '
557560
'not be verified to be exempt\n'
558561
'from version changes according to repository policy.\n'
559562
'If this is a false positive, please comment in '
560563
'the PR to explain why the PR\n'
561564
'is exempt, and add (or ask your reviewer to add) the '
562-
'"$_missingVersionChangeOverrideLabel" label.');
563-
return 'Missing version change';
565+
'"$_missingVersionChangeOverrideLabel" label.\n');
564566
}
565567
}
566568

@@ -569,18 +571,32 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog.
569571
logWarning('Ignoring lack of CHANGELOG update due to the '
570572
'"$_missingChangelogChangeOverrideLabel" label.');
571573
} else {
574+
missingChangelogChange = true;
572575
printError('No CHANGELOG change found.\n'
573576
'If this PR needs an exemption from the standard policy of listing '
574577
'all changes in the CHANGELOG,\n'
575578
'comment in the PR to explain why the PR is exempt, and add (or '
576579
'ask your reviewer to add) the\n'
577580
'"$_missingChangelogChangeOverrideLabel" label.\n'
578581
'Otherwise, please add a NEXT entry in the CHANGELOG as described in '
579-
'the contributing guide.');
580-
return 'Missing CHANGELOG change';
582+
'the contributing guide.\n');
581583
}
582584
}
583585

586+
if (missingVersionChange && missingChangelogChange) {
587+
printError('If this PR is not exempt, you can update version and '
588+
'CHANGELOG with the "update-release-info" command.\\\n'
589+
'See here for an example: '
590+
'https://github.com/flutter/packages/blob/main/script/tool/README.md#update-changelog-and-version\\\n'
591+
'For more details on versioning, check the contributing guide.');
592+
}
593+
if (missingVersionChange) {
594+
return 'Missing version change';
595+
}
596+
if (missingChangelogChange) {
597+
return 'Missing CHANGELOG change';
598+
}
599+
584600
return null;
585601
}
586602
}

script/tool/test/version_check_command_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ void main() {
787787
});
788788

789789
test(
790-
'fails if a version change is missing from a change that does not '
791-
'pass the exemption check', () async {
790+
'fails if a version and CHANGELOG change is missing from a change '
791+
'that does not pass the exemption check', () async {
792792
final RepositoryPackage plugin =
793793
createFakePlugin('plugin', packagesDir, version: '1.0.0');
794794

@@ -819,6 +819,8 @@ packages/plugin/lib/plugin.dart
819819
output,
820820
containsAllInOrder(<Matcher>[
821821
contains('No version change found'),
822+
contains('No CHANGELOG change found.'),
823+
contains('"update-release-info" command'),
822824
contains('plugin:\n'
823825
' Missing version change'),
824826
]),

0 commit comments

Comments
 (0)