Repository: appwrite/appwrite
File: src/Appwrite/Vcs/Comment.php (PHP)

Code before:
            'previewUrl' => $previewUrl,
        ];
    }

    public function generateComment(): string
    {
        $json = \json_encode($this->builds);

        $text = $this->statePrefix . \base64_encode($json) . "\n\n";

        $projects = [];

        foreach ($this->builds as $id => $build) {
            if (!\array_key_exists($build['projectId'], $projects)) {
                $projects[$build['projectId']] = [
                    'name' => $build['projectName'],
                    'function' => [],
                    'site' => []
                ];
            }

            if ($build['resourceType'] === 'site') {
                $projects[$build['projectId']]['site'][$build['resourceId']] = [
                    'name' => $build['resourceName'],
                    'status' => $build['buildStatus'],
                    'deploymentId' => $build['deploymentId'],
                    'action' => $build['action'],
                    'previewUrl' => $build['previewUrl'],
                ];
            } elseif ($build['resourceType'] === 'function') {
                $projects[$build['projectId']]['function'][$build['resourceId']] = [
                    'name' => $build['resourceName'],
                    'status' => $build['buildStatus'],
                    'deploymentId' => $build['deploymentId'],
                    'action' => $build['action'],
                ];
            }
        }

        $i = 0;
        foreach ($projects as $projectId => $project) {
            $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
            $hostname = System::getEnv('_APP_DOMAIN');

            $text .= "## {$project['name']}\n\n";
            $text .= "Project ID: `{$projectId}`\n\n";

            $isOpen = $i === 0;

            if (\count($project['site']) > 0) {
                $text .= "<details" . ($isOpen ? ' open' : '') . ">\n";

Review comment (security):
Are we sure the builds table has a region? 

```
mysql> describe _1_builds;
+----------------------+---------------+------+-----+---------+----------------+
| Field                | Type          | Null | Key | Default | Extra          |
+----------------------+---------------+------+-----+---------+----------------+
| _id                  | int unsigned  | NO   | PRI | NULL    | auto_increment |
| _uid                 | varchar(255)  | NO   |     | NULL    |                |
| _createdAt           | datetime(3)   | YES  |     | NULL    |                |
| _updatedAt           | datetime(3)   | YES  |     | NULL    |                |
| _permissions         | mediumtext    | YES  |     | NULL    |                |
| startTime            | datetime(3)   | YES  |     | NULL    |                |
| endTime              | datetime(3)   | YES  |     | NULL    |                |
| duration             | int           | YES  |     | NULL    |                |
| size                 | int           | YES  |     | NULL    |                |
| deploymentInternalId | varchar(255)  | YES  |     | NULL    |                |
| deploymentId         | varchar(255)  | YES  |     | NULL    |                |
| runtime              | varchar(2048) | YES  |     | NULL    |                |
| status               | varchar(256)  | YES  |     | NULL    |                |
| path                 | varchar(2048) | YES  |     | NULL    |                |
| logs                 | mediumtext    | YES  |     | NULL    |                |
| sourceType           | varchar(2048) | YES  |     | NULL    |                |
| source               | varchar(2048) | YES  |     | NULL    |                |
| _tenant              | int unsigned  | YES  | MUL | NULL    |                |
+----------------------+---------------+------+-----+---------+----------------+
```

This is what I see 

Code after:
            'action' => $action,
            'previewUrl' => $previewUrl,
        ];
    }

    public function generateComment(): string
    {
        $json = \json_encode($this->builds);

        $text = $this->statePrefix . \base64_encode($json) . "\n\n";

        $projects = [];

        foreach ($this->builds as $id => $build) {
            if (!\array_key_exists($build['projectId'], $projects)) {
                $projects[$build['projectId']] = [
                    'name' => $build['projectName'],
                    'function' => [],
                    'site' => []
                ];
            }

            if ($build['resourceType'] === 'site') {
                $projects[$build['projectId']]['site'][$build['resourceId']] = [
                    'name' => $build['resourceName'],
                    'region' => $build['region'],
                    'status' => $build['buildStatus'],
                    'deploymentId' => $build['deploymentId'],
                    'action' => $build['action'],
                    'previewUrl' => $build['previewUrl'],
                ];
            } elseif ($build['resourceType'] === 'function') {
                $projects[$build['projectId']]['function'][$build['resourceId']] = [
                    'name' => $build['resourceName'],
                    'region' => $build['region'],
                    'status' => $build['buildStatus'],
                    'deploymentId' => $build['deploymentId'],
                    'action' => $build['action'],
                ];
            }
        }

        $i = 0;
        foreach ($projects as $projectId => $project) {
            $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
            $hostname = System::getEnv('_APP_DOMAIN');

            $text .= "## {$project['name']}\n\n";
            $text .= "Project ID: `{$projectId}`\n\n";

            $isOpen = $i === 0;