Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/Data/Casts/ChangelogCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Data\Casts;

use Illuminate\Support\Str;
use Illuminate\Support\Stringable;
use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty;
Expand Down Expand Up @@ -37,16 +36,15 @@ class ChangelogCast implements Cast

public function __construct(
protected bool $short = false
) {
}
) {}

public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): string
{
return Str::of($this->removeEmojis($value))
->replaceMatches([$this->from, $this->fullLink], '')
->replaceMatches($this->contributors, $this->contributor)
->when($this->short, fn (Stringable $str) => $str->limit(2000, preserveWords: true))
->trim()
->short(2000)
->markdown($this->options)
->replaceMatches($this->resolveSpaces, '<li>$1</li>')
->stripTags($this->allowedTags)
Expand Down
4 changes: 2 additions & 2 deletions app/Helpers/BoostyStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ protected static function style(string $content): array

while (Str::contains($content, '<')) {
$position = Str::position($content, '<');
$tag = Str::betweenFirst($content, '<', '>');
$value = Str::betweenFirst($content, "<$tag>", "</$tag>");
$tag = Str::betweenFirst($content, '<', '>');
$value = Str::betweenFirst($content, "<$tag>", "</$tag>");

$length = Str::length($value);

Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/PullRequestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class PullRequestController extends Controller
{
public function __construct(
protected readonly PullRequest $pullRequest
) {
}
) {}

public function assign(AssignRequest $request)
{
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/ReleaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class ReleaseController extends Controller
{
public function __construct(
protected readonly Release $release
) {
}
) {}

public function publish(ReleaseRequest $request)
{
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/RepositoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class RepositoryController extends Controller
{
public function __construct(
protected readonly Repository $repository
) {
}
) {}

public function create(RepositoryRequest $request)
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Middleware/GitHubMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class GitHubMiddleware
{
protected const ALGO = 'sha256';
protected const ALGO = 'sha256';
protected const AUTH_HEADER = 'X-Hub-Signature-256';
protected const PING_HEADER = 'X-GitHub-Event';

Expand Down Expand Up @@ -72,7 +72,7 @@ protected function connect(Request $request): void
}

$organization = Arr::get($request->get('repository'), 'owner.login');
$repository = Arr::get($request->get('repository'), 'name');
$repository = Arr::get($request->get('repository'), 'name');

ConnectRepositoryJob::dispatch($organization, $repository);
}
Expand Down
3 changes: 1 addition & 2 deletions app/Integrations/Boosty.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
public function __construct(
protected string $token,
protected string $blog,
) {
}
) {}

public function publish(string $title, string $body, string $url, array $tags): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Jobs/GitHub/AutoMergeJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class AutoMergeJob extends Job
{
public function __construct(
public PullRequestData $data
) {
}
) {}

public function handle(PullRequest $pullRequest): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Jobs/GitHub/ConnectOrganizationJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class ConnectOrganizationJob extends Job implements ShouldBeUnique
{
public function __construct(
public string $organization
) {
}
) {}

public function handle(Organization $organization): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Jobs/GitHub/ConnectRepositoryJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
public string $organization,
public string $repository,
public bool $withWebhooks = true
) {
}
) {}

public function handle(): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Jobs/GitHub/DependabotJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class DependabotJob extends Job implements ShouldBeUnique

public function __construct(
public PullRequestData $data
) {
}
) {}

public function handle(PullRequest $pullRequest): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Jobs/GitHub/SyncLabelsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class SyncLabelsJob extends Job
public function __construct(
public string $organization,
public string $repository
) {
}
) {}

public function handle(Repository $repository): void
{
Expand Down
3 changes: 2 additions & 1 deletion app/Jobs/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ protected function releaseAfter(Closure $callback, string $exceptionClass, int $
{
try {
$callback();
} catch (Throwable $e) {
}
catch (Throwable $e) {
if (Instance::of($e, $exceptionClass)) {
$this->release($minutes * 60);

Expand Down
29 changes: 29 additions & 0 deletions app/Providers/StringServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\Support\Stringable;

class StringServiceProvider extends ServiceProvider
{
public function boot(): void
{
Stringable::macro('short', function (int $limit): Stringable {
$value = $this->value();

while ($limit < Str::length($value)) {
$lines = Str::of($value)->explode("\n");

$lines->pop();

$value = $lines->implode("\n");
}

return new Stringable($value);
});
}
}
3 changes: 1 addition & 2 deletions app/Rules/InCollectionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
public function __construct(
protected string $key,
protected array|string $values
) {
}
) {}

public function validate(string $attribute, mixed $value, Closure $fail): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Rules/NotInCollectionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
public function __construct(
protected string $key,
protected array|string $values
) {
}
) {}

public function validate(string $attribute, mixed $value, Closure $fail): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Services/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class Organization
public function __construct(
protected GitHubManager $github,
protected ResultPager $paginator
) {
}
) {}

public function repositories(string $organization): array
{
Expand Down
5 changes: 2 additions & 3 deletions app/Services/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
protected GitHubManager $github,
protected TeamParser $teamParser,
protected User $user,
) {
}
) {}

public function autoMerge(PullRequestData $data): void
{
Expand All @@ -46,7 +45,7 @@ public function wasApproved(PullRequestData $data): bool
);

foreach ($reviews as $review) {
$body = Arr::get($review, 'body');
$body = Arr::get($review, 'body');
$userId = Arr::get($review, 'user.id');

if ($body === $this->autoApproveMessage && $this->user->isMe($userId)) {
Expand Down
3 changes: 1 addition & 2 deletions app/Services/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class Repository
{
public function __construct(
protected GitHubManager $github
) {
}
) {}

public function connect(RepositoryData $data): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/Services/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class User
{
public function __construct(
protected GitHubManager $github,
) {
}
) {}

public function isMe(?int $userId): bool
{
Expand Down
2 changes: 2 additions & 0 deletions bootstrap/providers.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

use App\Providers\IntegrationServiceProvider;
use App\Providers\StringServiceProvider;

return [
IntegrationServiceProvider::class,
StringServiceProvider::class,
];
3 changes: 1 addition & 2 deletions database/migrations/0001_01_01_000000_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
3 changes: 1 addition & 2 deletions database/migrations/0001_01_01_000001_create_cache_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
3 changes: 1 addition & 2 deletions database/migrations/0001_01_01_000002_create_jobs_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Get the migration connection name.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
public function up(): void
{
Schema::create('telegraph_bots', function (Blueprint $table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
public function up(): void
{
Schema::create('telegraph_chats', function (Blueprint $table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
public function up(): void
{
Schema::table('telegraph_chats', function (Blueprint $table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
public function up(): void
{
Schema::table('telegraph_chats', function (Blueprint $table) {
Expand Down
3 changes: 1 addition & 2 deletions operations/2024_01_01_0000_register_webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use App\Console\Commands\RegisterWebhooks;
use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation
{
return new class extends Operation {
protected bool $once = false;

protected bool $before = false;
Expand Down
3 changes: 1 addition & 2 deletions operations/2024_03_21_235136_register_bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use DefStudio\Telegraph\Models\TelegraphBot;
use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation
{
return new class extends Operation {
public function __invoke(): void
{
$this->create($this->token(), $this->name());
Expand Down
3 changes: 1 addition & 2 deletions operations/2024_03_23_210559_restart_all_failed_jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation
{
return new class extends Operation {
protected bool $before = false;

public function __invoke(): void
Expand Down
3 changes: 1 addition & 2 deletions operations/2024_03_23_211006_restart_all_failed_jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation
{
return new class extends Operation {
protected bool $before = false;

public function __invoke(): void
Expand Down
3 changes: 1 addition & 2 deletions operations/2024_03_24_160040_create_new_labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use App\Jobs\GitHub\ConnectOrganizationJob;
use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation
{
return new class extends Operation {
protected bool $before = false;

protected string $organization = 'Laravel-Lang';
Expand Down
Loading