Change pub roller bot to push to flutter-pub-roller-bot/flutter.git (#129844)

Fixes https://github.com/flutter/flutter/issues/129744
Part of https://github.com/flutter/flutter/issues/129847

Migrate the packages_autoroller script to push to
flutter-pub-roller-bot/flutter.git, rather than
fluttergithubbot/flutter.git.
This commit is contained in:
Christopher Fujino 2023-06-30 16:28:00 -07:00 committed by GitHub
parent 1153371a56
commit 67b7aa22c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 18 deletions

View file

@ -243,8 +243,6 @@ targets:
- name: Linux packages_autoroller
presubmit: false
# TODO(fujino): https://github.com/flutter/flutter/issues/129744
bringup: true
recipe: pub_autoroller/pub_autoroller
timeout: 30
enabled_branches:

View file

@ -15,8 +15,8 @@ import 'package:process/process.dart';
const String kTokenOption = 'token';
const String kGithubClient = 'github-client';
const String kMirrorRemote = 'mirror-remote';
const String kUpstreamRemote = 'upstream-remote';
const String kGithubAccountName = 'flutter-pub-roller-bot';
Future<void> main(List<String> args) {
return run(args);
@ -39,11 +39,10 @@ Future<void> run(
help: 'Path to GitHub CLI client. If not provided, it is assumed `gh` is '
'present on the PATH.',
);
// TODO(fujino): delete after recipe has been migrated to stop passing this
parser.addOption(
kMirrorRemote,
help: 'The mirror git remote that the feature branch will be pushed to. '
'Required',
mandatory: true,
'mirror-remote',
help: '(Deprecated) this is now a no-op. To change the account, edit this tool.',
);
parser.addOption(
kUpstreamRemote,
@ -64,7 +63,7 @@ ${parser.usage}
rethrow;
}
final String mirrorUrl = results[kMirrorRemote]! as String;
const String mirrorUrl = 'https://github.com/flutter-pub-roller-bot/flutter.git';
final String upstreamUrl = results[kUpstreamRemote]! as String;
final String tokenPath = results[kTokenOption]! as String;
final File tokenFile = fs.file(tokenPath);
@ -92,6 +91,7 @@ ${parser.usage}
orgName: _parseOrgName(mirrorUrl),
token: token,
processManager: processManager,
githubUsername: kGithubAccountName,
).roll();
}

View file

@ -20,7 +20,7 @@ class PackageAutoroller {
required this.framework,
required this.orgName,
required this.processManager,
this.githubUsername = 'fluttergithubbot',
required this.githubUsername,
Stdio? stdio,
}) {
this.stdio = stdio ?? VerboseStdio.local();
@ -111,7 +111,7 @@ This PR was generated by the automated
Future<bool> updatePackages({
bool verbose = true,
}) async {
final String author = '$githubUsername <$githubUsername@gmail.com>';
final String author = '$githubUsername <$githubUsername@google.com>';
await framework.newBranch(await featureBranchName);
final io.Process flutterProcess = await framework.streamFlutter(<String>[

View file

@ -63,6 +63,7 @@ void main() {
orgName: orgName,
processManager: processManager,
stdio: stdio,
githubUsername: 'flutter-pub-roller-bot',
);
});
@ -199,7 +200,7 @@ void main() {
'pr',
'list',
'--author',
'fluttergithubbot',
'flutter-pub-roller-bot',
'--repo',
'flutter/flutter',
'--state',
@ -216,7 +217,7 @@ void main() {
await controller.stream.drain();
await rollFuture;
expect(processManager, hasNoRemainingExpectations);
expect(stdio.stdout, contains('fluttergithubbot already has open tool PRs'));
expect(stdio.stdout, contains('flutter-pub-roller-bot already has open tool PRs'));
expect(stdio.stdout, contains(r'[{number: 123}]'));
});
@ -239,7 +240,7 @@ void main() {
'pr',
'list',
'--author',
'fluttergithubbot',
'flutter-pub-roller-bot',
'--repo',
'flutter/flutter',
'--state',
@ -335,7 +336,7 @@ void main() {
'pr',
'list',
'--author',
'fluttergithubbot',
'flutter-pub-roller-bot',
'--repo',
'flutter/flutter',
'--state',
@ -427,7 +428,7 @@ void main() {
'commit',
'--message',
'roll packages',
'--author="fluttergithubbot <fluttergithubbot@gmail.com>"',
'--author="flutter-pub-roller-bot <flutter-pub-roller-bot@google.com>"',
]),
const FakeCommand(command: <String>[
'git',
@ -475,12 +476,11 @@ void main() {
group('command argument validations', () {
const String tokenPath = '/path/to/token';
const String mirrorRemote = 'https://githost.com/org/project';
test('validates that file exists at --token option', () async {
await expectLater(
() => run(
<String>['--token', tokenPath, '--mirror-remote', mirrorRemote],
<String>['--token', tokenPath],
fs: fileSystem,
processManager: processManager,
),
@ -499,7 +499,7 @@ void main() {
..writeAsStringSync('');
await expectLater(
() => run(
<String>['--token', tokenPath, '--mirror-remote', mirrorRemote],
<String>['--token', tokenPath],
fs: fileSystem,
processManager: processManager,
),