Unverified Commit 0d277223 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

migrate the package_autoroller from querying by label to title (#128066)

Fixes https://github.com/flutter/flutter/issues/128067
parent 1a098ae8
...@@ -50,9 +50,11 @@ class PackageAutoroller { ...@@ -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`. ...@@ -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`. ...@@ -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`. ...@@ -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`. ...@@ -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() { ...@@ -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() { ...@@ -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() { ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment