add custom git commit deployment

This commit is contained in:
Andras Bacsai
2023-05-10 12:22:27 +02:00
parent 775ee5d27a
commit fe6ecd465e
10 changed files with 37 additions and 15 deletions

View File

@@ -44,16 +44,23 @@ class Application extends BaseModel
set: fn ($value) => $value ? '/' . ltrim($value, '/') : null,
);
}
public function gitLocation(): Attribute
public function gitBranchLocation(): Attribute
{
return Attribute::make(
get: function () {
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
if (is_null($this->git_commit_sha)) {
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}";
} else {
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_commit_sha}";
}
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}";
}
}
);
}
public function gitCommits(): Attribute
{
return Attribute::make(
get: function () {
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
return "{$this->source->html_url}/{$this->git_repository}/commits/{$this->git_branch}";
}
}