我是新手,但我在github上获得了对webhook的502响应。它在当地完成。我放入了localhost / deploy.php,我尝试过localhost.com/deploy.php,我尝试过使用ngrok。就像我说的那样,我以前从未这样做过<我不确定有什么问题。
以下是我的deploy.php
<?php
use CompleteSolar\Home\Controllers\DeployController;
require_once __DIR__.'/setup.php';
require_once __DIR__.'/../vendor/autoload.php';
$controller = new DeployController();
exit(
$controller->deploy(
$config->getProperty(["github","localRoot"]),
$config->getProperty(["github","branch"]),
$config->getProperty(["github","repoSecret"]),
$config->getProperty(["github","deployCommands"]),
$config->getProperty(["bugsnag","clientId"])
)
);
Setup.php
<?php use CompleteSolar\HelioConfig\Utilities\Config;
use CompleteSolar\HelioTrack\Handlers\BugsnagHandler;
use CompleteSolar\HelioTrack\Handlers\ErrorHandler;
require_once __DIR__.'/../vendor/autoload.php';
date_default_timezone_set("America/Los_Angeles");
$configPath = __DIR__.'/../config/default.ini';
$config = new Config($configPath,true);
$errorLevel = $config->getProperty(["general","errorLevel"]);
error_reporting($errorLevel);
ini_set('display_errors', $errorLevel ? 'On' : 'Off');
// Configure Bugsnag
if(!isset($bugsnag)){
$bugsnag = new BugsnagHandler(
$config->getProperty(["bugsnag","clientId"]),
$config->getProperty(['github','branch']),
E_ERROR
);
$errorHandler = new ErrorHandler($bugsnag);
set_error_handler(array($errorHandler, "handleError"));
set_exception_handler(array($errorHandler, "handleException"));
}
?>
DeployController.php
<?php
namespace CompleteSolar\Home\Controllers;
use alanmanderson\clever_deploy\CleverDeploy;
class DeployController {
public function deploy($localRoot, $branch, $repoSecret, $cmds, $bugsnagApiKey){
$cd = new CleverDeploy($localRoot, '', '', $branch, $repoSecret);
$cmds[] = "curl -d \"apiKey=$bugsnagApiKey&releaseStage=$branch\" http://notify.bugsnag.com/deploy";
return $cd->deploy($cmds);
}
}
?>