blob: 55670e036d707dd8c26f174c4e91af281399f77a [file]
// Copyright 2020 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import '../request_handling/api_request_handler.dart';
import '../request_handling/request_handler.dart';
import '../request_handling/response.dart';
import '../service/branch_service.dart';
/// Creates the flutter/recipes branch to match a flutter/flutter branch.
///
/// This is used by Google Testing to create release infra whenever a good
/// commit has been found, and is being considered as the branch point to
/// be rolled into Google.
final class CreateBranch extends ApiRequestHandler {
const CreateBranch({
required BranchService branchService,
required super.config,
required super.authenticationProvider,
}) : _branchService = branchService;
final BranchService _branchService;
static const String branchParam = 'branch';
// Intentionally kept at 'engine' as there may be scripts out there.
static const String engineShaParam = 'engine';
@override
Future<Response> get(Request request) async {
checkRequiredQueryParameters(request, <String>[
branchParam,
engineShaParam,
]);
final branch = request.uri.queryParameters[branchParam]!;
final engineSha = request.uri.queryParameters[engineShaParam]!;
await _branchService.branchFlutterRecipes(branch, engineSha);
return Response.emptyOk;
}
}