wip
This commit is contained in:
@@ -16,18 +16,21 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
||||
{
|
||||
use Queueable;
|
||||
public Application $application;
|
||||
public string $application_name;
|
||||
public string $deployment_uuid;
|
||||
public int $pull_request_id;
|
||||
|
||||
public string $application_name;
|
||||
public string|null $deployment_url = null;
|
||||
public string $project_uuid;
|
||||
public string $environment_name;
|
||||
public string $fqdn;
|
||||
|
||||
public function __construct(Application $application, string $deployment_uuid)
|
||||
public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->deployment_uuid = $deployment_uuid;
|
||||
$this->pull_request_id = $pull_request_id;
|
||||
|
||||
$this->application_name = data_get($application, 'name');
|
||||
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
||||
$this->environment_name = data_get($application, 'environment.name');
|
||||
@@ -56,14 +59,20 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
||||
'name' => $this->application_name,
|
||||
'fqdn' => $this->fqdn,
|
||||
'url' => $this->deployment_url,
|
||||
'pull_request_id' => $this->pull_request_id,
|
||||
]);
|
||||
return $mail;
|
||||
}
|
||||
|
||||
public function toDiscord(): string
|
||||
{
|
||||
return '✅ A new version has been deployed of **' . $this->application_name . '**.
|
||||
|
||||
[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
|
||||
if ($this->pull_request_id !== 0) {
|
||||
$message = '✅ Pull request #' . $this->pull_request_id . ' of **' . $this->application_name . '**.';
|
||||
} else {
|
||||
$message = '✅ A new version has been deployed of **' . $this->application_name . '**.';
|
||||
}
|
||||
$message .= "\n\n";
|
||||
$message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,21 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
public Application $application;
|
||||
public string $application_name;
|
||||
public string $deployment_uuid;
|
||||
public int $pull_request_id;
|
||||
|
||||
public string $application_name;
|
||||
public string|null $deployment_url = null;
|
||||
public string $project_uuid;
|
||||
public string $environment_name;
|
||||
public string $fqdn;
|
||||
|
||||
public function __construct(Application $application, string $deployment_uuid)
|
||||
public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->deployment_uuid = $deployment_uuid;
|
||||
$this->pull_request_id = $pull_request_id;
|
||||
|
||||
$this->application_name = data_get($application, 'name');
|
||||
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
||||
$this->environment_name = data_get($application, 'environment.name');
|
||||
@@ -56,14 +59,20 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
||||
'name' => $this->application_name,
|
||||
'fqdn' => $this->fqdn,
|
||||
'url' => $this->deployment_url,
|
||||
'pull_request_id' => $this->pull_request_id,
|
||||
]);
|
||||
return $mail;
|
||||
}
|
||||
|
||||
public function toDiscord(): string
|
||||
{
|
||||
return '❌ Deployment failed of **' . $this->application_name . '**.
|
||||
|
||||
[Deployment logs](' . $this->deployment_url . ')';
|
||||
$message = '❌ Deployment failed of **' . $this->application_name;
|
||||
if ($this->pull_request_id !== 0) {
|
||||
$message .= ": PR# {$this->pull_request_id}";
|
||||
}
|
||||
$message .= '**.';
|
||||
$message .= "\n\n";
|
||||
$message .= "[Deployment logs]({$this->deployment_url})";
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user