migrate the package_autoroller from querying by label to title (#128066)
Fixes https://github.com/flutter/flutter/issues/128067
This commit is contained in:
parent
1a098ae8eb
commit
0d2772238e
@ -50,9 +50,11 @@ class PackageAutoroller {
|
|||||||
|
|
||||||
static const String hostname = 'github.com';
|
static const String hostname = 'github.com';
|
||||||
|
|
||||||
static const String prBody = '''
|
String get prBody {
|
||||||
This PR was generated by `flutter update-packages --force-upgrade`.
|
return '''
|
||||||
''';
|
This PR was generated by the automated
|
||||||
|
[Pub packages autoroller](https://github.com/flutter/flutter/blob/main/dev/conductor/core/bin/packages_autoroller.dart).''';
|
||||||
|
}
|
||||||
|
|
||||||
/// Name of the feature branch to be opened on against the mirror repo.
|
/// Name of the feature branch to be opened on against the mirror repo.
|
||||||
///
|
///
|
||||||
@ -166,12 +168,13 @@ This PR was generated by `flutter update-packages --force-upgrade`.
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const String _prTitle = 'Roll pub packages';
|
||||||
|
|
||||||
/// Create a pull request on GitHub.
|
/// Create a pull request on GitHub.
|
||||||
///
|
///
|
||||||
/// Depends on the gh cli tool.
|
/// Depends on the gh cli tool.
|
||||||
Future<void> createPr({
|
Future<void> createPr({
|
||||||
required io.Directory repository,
|
required io.Directory repository,
|
||||||
String title = 'Roll pub packages',
|
|
||||||
String body = 'This PR was generated by `flutter update-packages --force-upgrade`.',
|
String body = 'This PR was generated by `flutter update-packages --force-upgrade`.',
|
||||||
String base = FrameworkRepository.defaultBranch,
|
String base = FrameworkRepository.defaultBranch,
|
||||||
bool draft = false,
|
bool draft = false,
|
||||||
@ -185,7 +188,7 @@ This PR was generated by `flutter update-packages --force-upgrade`.
|
|||||||
'pr',
|
'pr',
|
||||||
'create',
|
'create',
|
||||||
'--title',
|
'--title',
|
||||||
title.trim(),
|
_prTitle,
|
||||||
'--body',
|
'--body',
|
||||||
body.trim(),
|
body.trim(),
|
||||||
'--head',
|
'--head',
|
||||||
@ -257,15 +260,19 @@ This PR was generated by `flutter update-packages --force-upgrade`.
|
|||||||
final String openPrString = await cli(<String>[
|
final String openPrString = await cli(<String>[
|
||||||
'pr',
|
'pr',
|
||||||
'list',
|
'list',
|
||||||
|
|
||||||
'--author',
|
'--author',
|
||||||
githubUsername,
|
githubUsername,
|
||||||
|
|
||||||
'--repo',
|
'--repo',
|
||||||
'flutter/flutter',
|
'flutter/flutter',
|
||||||
|
|
||||||
'--state',
|
'--state',
|
||||||
'open',
|
'open',
|
||||||
// We are only interested in pub rolls, not devicelab flaky PRs
|
|
||||||
'--label',
|
'--search',
|
||||||
'tool',
|
_prTitle,
|
||||||
|
|
||||||
// Return structured JSON with the PR numbers of open PRs
|
// Return structured JSON with the PR numbers of open PRs
|
||||||
'--json',
|
'--json',
|
||||||
'number',
|
'number',
|
||||||
@ -274,6 +281,7 @@ This PR was generated by `flutter update-packages --force-upgrade`.
|
|||||||
// This will be an array of objects, one for each open PR.
|
// This will be an array of objects, one for each open PR.
|
||||||
final List<Object?> openPrs = json.decode(openPrString) as List<Object?>;
|
final List<Object?> openPrs = json.decode(openPrString) as List<Object?>;
|
||||||
|
|
||||||
|
// We are only interested in pub rolls, not devicelab flaky PRs
|
||||||
if (openPrs.isNotEmpty) {
|
if (openPrs.isNotEmpty) {
|
||||||
log('$githubUsername already has open tool PRs:\n$openPrs');
|
log('$githubUsername already has open tool PRs:\n$openPrs');
|
||||||
return true;
|
return true;
|
||||||
|
@ -204,8 +204,8 @@ void main() {
|
|||||||
'flutter/flutter',
|
'flutter/flutter',
|
||||||
'--state',
|
'--state',
|
||||||
'open',
|
'open',
|
||||||
'--label',
|
'--search',
|
||||||
'tool',
|
'Roll pub packages',
|
||||||
'--json',
|
'--json',
|
||||||
'number',
|
'number',
|
||||||
// Non empty array means there are open PRs by the bot with the tool label
|
// Non empty array means there are open PRs by the bot with the tool label
|
||||||
@ -244,8 +244,8 @@ void main() {
|
|||||||
'flutter/flutter',
|
'flutter/flutter',
|
||||||
'--state',
|
'--state',
|
||||||
'open',
|
'open',
|
||||||
'--label',
|
'--search',
|
||||||
'tool',
|
'Roll pub packages',
|
||||||
'--json',
|
'--json',
|
||||||
'number',
|
'number',
|
||||||
// Returns empty array, as there are no other open roll PRs from the bot
|
// Returns empty array, as there are no other open roll PRs from the bot
|
||||||
@ -340,8 +340,8 @@ void main() {
|
|||||||
'flutter/flutter',
|
'flutter/flutter',
|
||||||
'--state',
|
'--state',
|
||||||
'open',
|
'open',
|
||||||
'--label',
|
'--search',
|
||||||
'tool',
|
'Roll pub packages',
|
||||||
'--json',
|
'--json',
|
||||||
'number',
|
'number',
|
||||||
// Returns empty array, as there are no other open roll PRs from the bot
|
// Returns empty array, as there are no other open roll PRs from the bot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user