mirror of
git://f0xx.org/ac/ac-ms-build
synced 2026-07-29 06:19:04 +03:00
initial
This commit is contained in:
27
public/api/build_trigger.php
Normal file
27
public/api/build_trigger.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/../../src/bootstrap.php';
|
||||
Auth::check();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
json_out(['ok' => false, 'error' => 'POST required'], 405);
|
||||
}
|
||||
|
||||
$raw = file_get_contents('php://input') ?: '{}';
|
||||
$params = json_decode($raw, true);
|
||||
if (!is_array($params)) {
|
||||
$params = $_POST;
|
||||
}
|
||||
|
||||
$params['pipeline_yaml'] = BuildRunner::resolvePipelineYaml($params);
|
||||
$params['run_tests'] = !empty($params['run_tests']);
|
||||
$params['run_native'] = array_key_exists('run_native', $params) ? !empty($params['run_native']) : true;
|
||||
$params['run_apk'] = array_key_exists('run_apk', $params) ? !empty($params['run_apk']) : true;
|
||||
$params['auto_ota'] = !empty($params['auto_ota']);
|
||||
$params['auto_deploy'] = !empty($params['auto_deploy']);
|
||||
$params['ota_channel'] = $params['ota_channel'] ?? 'staging';
|
||||
$params['gradle_task'] = $params['gradle_task'] ?? 'assembleDebug';
|
||||
|
||||
$user = Auth::user();
|
||||
$build = BuildRunner::enqueue($params, isset($user['id']) ? (int) $user['id'] : null);
|
||||
json_out(['ok' => true, 'build' => $build]);
|
||||
Reference in New Issue
Block a user