You've already forked gitea-composer-upload-action
create Action class
This commit is contained in:
29
app.php
29
app.php
@@ -4,15 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use App\Action;
|
||||
use App\Configuration\Configuration;
|
||||
|
||||
$configuration = (new Configuration())
|
||||
->set('param', 123)
|
||||
;
|
||||
|
||||
dd($configuration->getCastingType('param', 'string')->getAsCasting());
|
||||
|
||||
exit();
|
||||
use App\Casting\MapperType;
|
||||
|
||||
\define('RED', "\033[0;31m");
|
||||
\define('GREEN', "\033[1;32m");
|
||||
@@ -20,6 +14,25 @@ exit();
|
||||
\define('LITE_CYAN', "\e[96m");
|
||||
\define('NC', "\033[0m");
|
||||
|
||||
try {
|
||||
|
||||
$configuration = (new Configuration())
|
||||
->set('base_url', \getenv('gitea_instance_base_url'))
|
||||
->set('access_token', \getenv('gitea_access_token'))
|
||||
->set('owner', \getenv('gitea_owner'))
|
||||
->set('owner', \getenv('gitea_owner'))
|
||||
->set('repository', \getenv('gitea_repository'))
|
||||
->set('package_registry', \getenv('gitea_package_registry'))
|
||||
;
|
||||
|
||||
(new Action($configuration))->run();
|
||||
|
||||
} catch (Exception) {
|
||||
// echo 'Error: ' . $e->getMessage() . "\n" . 'Trace: ' . $e->getTraceAsString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sendRequest ($method = 'GET', $endpoint = '', $data = []): array {
|
||||
|
||||
if (!\extension_loaded('curl')) {
|
||||
|
||||
37
src/Action.php
Normal file
37
src/Action.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Configuration\Configuration;
|
||||
|
||||
final class Action
|
||||
{
|
||||
private Configuration $configuration;
|
||||
|
||||
public function __construct(Configuration $configuration)
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
$this->checkExtensions();
|
||||
$this->checkConfiguration();
|
||||
|
||||
// $this->configuration->getCastingType('param', MapperType::STRING)->getAsCasting()
|
||||
}
|
||||
|
||||
private function checkExtensions(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function checkConfiguration(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user