Skip to content

Commit

Permalink
Updated to remove hardcoded test strings (#3101)
Browse files Browse the repository at this point in the history
Had some left over test strings that I unfortunately missed when submitting. This has caused some failures in flutter as the default branch there is master.

*List which issues are fixed by this PR. You must list at least one issue.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
  • Loading branch information
ricardoamador authored Sep 25, 2023
1 parent afae804 commit ee1dca0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions auto_submit/lib/action/git_cli_revert_method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import 'package:retry/retry.dart';

class GitCliRevertMethod implements RevertMethod {
@override
Future<github.PullRequest?> createRevert(Config config, github.PullRequest pullRequest) async {
Future<github.PullRequest?> createRevert(
Config config,
String initiatingAuthor,
github.PullRequest pullRequest,
) async {
final github.RepositorySlug slug = pullRequest.base!.repo!.slug();
final String commitSha = pullRequest.mergeCommitSha!;
// we will need to collect the pr number after the revert request is generated.
Expand Down Expand Up @@ -67,7 +71,7 @@ class GitCliRevertMethod implements RevertMethod {
final RevertIssueBodyFormatter formatter = RevertIssueBodyFormatter(
slug: slug,
originalPrNumber: pullRequest.number!,
initiatingAuthor: 'ricardoamador',
initiatingAuthor: initiatingAuthor,
originalPrTitle: pullRequest.title!,
originalPrBody: pullRequest.body!,
).format;
Expand All @@ -77,7 +81,7 @@ class GitCliRevertMethod implements RevertMethod {
slug: slug,
title: formatter.revertPrTitle,
head: gitRevertBranchName.branch,
base: 'main',
base: baseBranch,
draft: false,
body: formatter.revertPrBody,
);
Expand Down
2 changes: 1 addition & 1 deletion auto_submit/lib/action/revert_method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import 'package:github/github.dart' as github;

abstract class RevertMethod {
// Allows substitution of the method of creating the revert request.
Future<Object?> createRevert(Config config, github.PullRequest pullRequest);
Future<Object?> createRevert(Config config, String initiatingAuthor, github.PullRequest pullRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class RevertRequestValidationService extends ValidationService {
try {
// This is the autosubmit query result pull request from graphql.
final github.PullRequest pullRequest =
await revertMethod!.createRevert(config, messagePullRequest) as github.PullRequest;
await revertMethod!.createRevert(config, sender, messagePullRequest) as github.PullRequest;
log.info('Created revert pull request ${slug.fullName}/${pullRequest.number}.');
// This will come through this service again for processing.
await githubService.addLabels(slug, pullRequest.number!, [Config.kRevertOfLabel]);
Expand Down
2 changes: 1 addition & 1 deletion auto_submit/test/src/action/fake_revert_method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FakeRevertMethod implements RevertMethod {
bool throwException = false;

@override
Future<Object?> createRevert(Config config, PullRequest pullRequest) async {
Future<Object?> createRevert(Config config, String initiatingAuthor, PullRequest pullRequest) async {
if (throwException) {
throw 'Crappy github exception not related to the actual error.';
}
Expand Down

0 comments on commit ee1dca0

Please sign in to comment.