|
2 | 2 | /** |
3 | 3 | * @var $payload object |
4 | 4 | */ |
5 | | -?> |
6 | | - |
7 | | -@switch($payload->workflow_run->conclusion) |
8 | | - @case('success') |
9 | | -{!! __('tg-notifier::events/github/workflow_run.completed.success.title', ['user' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>"]) !!} |
10 | 5 |
|
11 | | -{!! __('tg-notifier::events/github/workflow_run.completed.success.body', ['name' => $payload->workflow_run->name]) !!} |
12 | | - @break |
13 | | - @case('failure') |
14 | | -{!! __('tg-notifier::events/github/workflow_run.completed.failure.title', ['user' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>"]) !!} |
15 | | - |
16 | | -{!! __('tg-notifier::events/github/workflow_run.completed.failure.body', ['name' => $payload->workflow_run->name]) !!} |
17 | | - @break |
18 | | - @case('cancelled') |
19 | | -{!! __('tg-notifier::events/github/workflow_run.completed.cancelled.title', ['user' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>"]) !!} |
| 6 | +match ($payload->workflow_run->conclusion) { |
| 7 | + 'success' => $status = 'success', |
| 8 | + 'failure' => $status = 'failure', |
| 9 | + 'cancelled' => $status = 'cancelled', |
| 10 | + default => $status = 'default', |
| 11 | +}; |
| 12 | +?> |
20 | 13 |
|
21 | | -{!! __('tg-notifier::events/github/workflow_run.completed.cancelled.body', ['name' => $payload->workflow_run->name]) !!} |
22 | | - @break |
23 | | - @default |
24 | | -{!! __('tg-notifier::events/github/workflow_run.completed.default.title', ['user' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>"]) !!} |
| 14 | +{!! __("tg-notifier::events/github/workflow_run.completed.$status.title", ['user' => "<a href='{$payload->repository->html_url}'>{$payload->repository->full_name}</a>"]) !!} |
25 | 15 |
|
26 | | -{!! __('tg-notifier::events/github/workflow_run.completed.default.body', ['name' => $payload->workflow_run->name]) !!} |
27 | | - @break |
28 | | -@endswitch |
| 16 | +{!! __("tg-notifier::events/github/workflow_run.completed.$status.body", ['name' => $payload->workflow_run->name]) !!} |
29 | 17 |
|
30 | 18 | {!! __('tg-notifier::events/github/workflow_run.link', ['link' => "<a href='{$payload->workflow_run->html_url}'>{$payload->workflow_run->event} - {$payload->workflow_run->name}</a>"]) !!} |
0 commit comments