new deployer command

This commit is contained in:
Mark Gregory
2026-09-16 13:22:16 +01:00
parent fac5df8cc3
commit 3410ab85fe
15 changed files with 26429 additions and 441 deletions
@@ -23,6 +23,8 @@ use Throwable;
final class GitWebhookIngestionService
{
private const PUSH_HOOK = 'push hook';
/**
* Matches the generated Helpdesk reference format, for example HD-2026-00042.
*/
@@ -173,10 +175,10 @@ final class GitWebhookIngestionService
return match ($normalisedProvider) {
'github' => in_array($normalisedEvent, ['push', ''], true),
'gitlab' => in_array($normalisedEvent, ['push hook', 'push', ''], true),
'gitea' => in_array($normalisedEvent, ['push', 'push hook', ''], true),
'gitlab' => in_array($normalisedEvent, [self::PUSH_HOOK, 'push', ''], true),
'gitea' => in_array($normalisedEvent, ['push', self::PUSH_HOOK, ''], true),
'bitbucket' => in_array($normalisedEvent, ['repo push', 'push', ''], true),
default => in_array($normalisedEvent, ['push', 'repo push', 'push hook', ''], true),
default => in_array($normalisedEvent, ['push', 'repo push', self::PUSH_HOOK, ''], true),
};
}
@@ -214,23 +216,14 @@ final class GitWebhookIngestionService
{
$commits = $payload['commits'] ?? null;
if (is_array($commits) && $commits !== []) {
return array_values(array_filter($commits, static fn (mixed $commit): bool => is_array($commit)));
if (! is_array($commits) || $commits === []) {
$headCommit = $payload['head_commit'] ?? null;
$commits = is_array($headCommit) ? [$headCommit] : Arr::get($payload, 'push.changes.0.commits', []);
}
$headCommit = $payload['head_commit'] ?? null;
if (is_array($headCommit)) {
return [$headCommit];
}
$bitbucketCommits = Arr::get($payload, 'push.changes.0.commits', []);
if (is_array($bitbucketCommits)) {
return array_values(array_filter($bitbucketCommits, static fn (mixed $commit): bool => is_array($commit)));
}
return [];
return is_array($commits)
? array_values(array_filter($commits, static fn (mixed $commit): bool => is_array($commit)))
: [];
}
/**