From e67f9a32b7696dc35244993018354412a29260c0 Mon Sep 17 00:00:00 2001 From: ch4r-ch4r Date: Mon, 16 Dec 2024 17:02:10 -0600 Subject: [PATCH 1/2] Enhance MarkdownBuilder to include environment URL in PR preview details --- app/Services/Comments/MarkdownBuilder.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Services/Comments/MarkdownBuilder.php b/app/Services/Comments/MarkdownBuilder.php index 7b5d5ce..5a734eb 100644 --- a/app/Services/Comments/MarkdownBuilder.php +++ b/app/Services/Comments/MarkdownBuilder.php @@ -17,6 +17,14 @@ class MarkdownBuilder { public function prepareBody(array $rows): string { + $environmentUrl = ''; + foreach ($rows as $row) { + if ($row['name'] === 'Environment Url') { + $environmentUrl = $row['content']; + break; + } + } + $body = []; foreach ($rows as $row) { @@ -28,13 +36,8 @@ public function prepareBody(array $rows): string $body[] = "| **{$row['name']}** | $content |"; } - return $this->getGitPrMarkdown($body); - } - - private function getGitPrMarkdown(array $body): string - { return "# Harbor Preview Environment Details -Hello! Here are the details of the preview environment for this pull request: +Hello! Here are the details of the [PR preview]($environmentUrl) environment: | Service | Location | |-------------|-------------------------|\n" From 48e2feaef568a7189e6f85ae311b635f302d27dd Mon Sep 17 00:00:00 2001 From: charlie Date: Tue, 17 Dec 2024 13:01:56 -0600 Subject: [PATCH 2/2] fix deleted code --- app/Services/Comments/MarkdownBuilder.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Services/Comments/MarkdownBuilder.php b/app/Services/Comments/MarkdownBuilder.php index 5a734eb..cc75567 100644 --- a/app/Services/Comments/MarkdownBuilder.php +++ b/app/Services/Comments/MarkdownBuilder.php @@ -36,6 +36,12 @@ public function prepareBody(array $rows): string $body[] = "| **{$row['name']}** | $content |"; } + return $this->getGitPrMarkdown($body); + } + + private function getGitPrMarkdown(array $body): string + { + return "# Harbor Preview Environment Details Hello! Here are the details of the [PR preview]($environmentUrl) environment: