Skip to content
This repository was archived by the owner on Nov 30, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Client/Requests/UpdateEnvironmentRequestData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct(
public readonly ?string $branch = null,
public readonly ?bool $usesPushToDeploy = null,
public readonly ?bool $usesDeployHook = null,
public readonly ?bool $usesReadOnlyBuildToken = null,
public readonly ?int $timeout = null,
public readonly ?string $phpVersion = null,
public readonly ?string $buildCommand = null,
Expand Down Expand Up @@ -65,6 +66,7 @@ public function toRequestData(): array
'branch' => $this->branch,
'uses_push_to_deploy' => $this->usesPushToDeploy,
'uses_deploy_hook' => $this->usesDeployHook,
'uses_read_only_build_token' => $this->usesReadOnlyBuildToken,
'timeout' => $this->timeout,
'php_version' => $this->phpVersion,
'build_command' => $this->buildCommand,
Expand Down
3 changes: 3 additions & 0 deletions app/Commands/EnvironmentUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class EnvironmentUpdate extends BaseCommand
{--node-version= : Node version (20, 22, 24, 26)}
{--uses-push-to-deploy= : Deploy on push}
{--uses-deploy-hook= : Enable the deploy hook}
{--uses-read-only-build-token= : Clone the repository with a read-only token during builds (GitHub only)}
{--uses-vanity-domain= : Serve the Laravel Cloud domain}
{--uses-octane= : Uses Octane}
{--http-basic-auth-password= : Require visitors to sign in as `admin` with this password; pass an empty value to turn basic auth off}
Expand Down Expand Up @@ -116,6 +117,7 @@ protected function updateEnvironment(Environment $environment): Environment
branch: $this->form()->get('branch'),
usesPushToDeploy: $this->form()->boolean('uses_push_to_deploy'),
usesDeployHook: $this->form()->boolean('uses_deploy_hook'),
usesReadOnlyBuildToken: $this->form()->boolean('uses_read_only_build_token'),
timeout: $this->form()->integer('timeout'),
phpVersion: $this->form()->get('php_version'),
buildCommand: $this->form()->get('build_command'),
Expand Down Expand Up @@ -331,6 +333,7 @@ protected function defineFields(Environment $environment): void

$this->defineBoolean('uses_push_to_deploy', 'Push to deploy', $environment->usesPushToDeploy);
$this->defineBoolean('uses_deploy_hook', 'Deploy hook', $environment->usesDeployHook);
$this->defineBoolean('uses_read_only_build_token', 'Read-only build token', $environment->usesReadOnlyBuildToken);
$this->defineBoolean('uses_vanity_domain', 'Vanity domain', null);
$this->defineBoolean('uses_octane', 'Octane', $environment->usesOctane);
$this->form()->define(
Expand Down
2 changes: 2 additions & 0 deletions app/Dto/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function __construct(
public readonly bool $usesHibernation = false,
public readonly bool $usesPushToDeploy = false,
public readonly bool $usesDeployHook = false,
public readonly bool $usesReadOnlyBuildToken = false,
#[WithTransformer(MaskEnvironmentVariables::class)]
public readonly array $environmentVariables = [],
public readonly array $networkSettings = [],
Expand Down Expand Up @@ -100,6 +101,7 @@ public static function createFromResponse(array $response): self
'usesHibernation' => $attributes['uses_hibernation'] ?? false,
'usesPushToDeploy' => $attributes['uses_push_to_deploy'] ?? false,
'usesDeployHook' => $attributes['uses_deploy_hook'] ?? false,
'usesReadOnlyBuildToken' => $attributes['uses_read_only_build_token'] ?? false,
'environmentVariables' => $attributes['environment_variables'] ?? [],
'networkSettings' => $attributes['network_settings'] ?? [],
'createdAt' => $attributes['created_at'] ?? null,
Expand Down
30 changes: 28 additions & 2 deletions tests/Feature/EnvironmentUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'shutdown_timeout' => 45,
'post_deploy_command' => 'php artisan cache:clear',
'uses_http_basic_auth' => true,
'uses_read_only_build_token' => true,
'internal_networking' => [
'enabled' => true,
'hostname' => 'production.internal',
Expand Down Expand Up @@ -122,6 +123,7 @@ function updateEnvironment(array $options): void
})->with([
['uses-push-to-deploy', 'uses_push_to_deploy', 'false', false],
['uses-deploy-hook', 'uses_deploy_hook', 'true', true],
['uses-read-only-build-token', 'uses_read_only_build_token', 'true', true],
['uses-vanity-domain', 'uses_vanity_domain', 'false', false],
['uses-octane', 'uses_octane', '0', false],
['uses-purge-edge-cache-on-deploy', 'uses_purge_edge_cache_on_deploy', '1', true],
Expand Down Expand Up @@ -236,7 +238,7 @@ function updateEnvironment(array $options): void
Artisan::registerCommand(new InteractiveEnvironmentUpdateCommand);

Prompt::fake([
...array_fill(0, 14, Key::DOWN), Key::SPACE, Key::ENTER,
...array_fill(0, 15, Key::DOWN), Key::SPACE, Key::ENTER,
Key::ENTER,
'h', 'u', 'n', 't', 'e', 'r', '2', Key::ENTER,
]);
Expand All @@ -253,7 +255,7 @@ function updateEnvironment(array $options): void
Artisan::registerCommand(new InteractiveEnvironmentUpdateCommand);

Prompt::fake([
...array_fill(0, 14, Key::DOWN), Key::SPACE, Key::ENTER,
...array_fill(0, 15, Key::DOWN), Key::SPACE, Key::ENTER,
'n', Key::ENTER,
]);

Expand Down Expand Up @@ -305,3 +307,27 @@ function updateEnvironment(array $options): void
expect(json_decode(Artisan::output(), true))->toBe(['modelGatewayKeyId' => 'mgk-1'])
->and(explode(',', $this->sent->include))->toContain('modelGatewayKey');
});

it('exposes whether builds use a read-only token', function () {
Artisan::call('environment:get', [
'environment' => 'env-1',
'--json' => true,
'--fields' => 'usesReadOnlyBuildToken',
'--no-interaction' => true,
]);

expect(json_decode(Artisan::output(), true))->toBe(['usesReadOnlyBuildToken' => true]);
});

it('turns the read-only build token off interactively', function () {
Artisan::registerCommand(new InteractiveEnvironmentUpdateCommand);

Prompt::fake([
...array_fill(0, 12, Key::DOWN), Key::SPACE, Key::ENTER,
'n', Key::ENTER,
]);

$this->artisan('test:interactive-environment-update', ['environment' => 'env-1'])->assertSuccessful();

expect($this->sent->body)->toBe(['uses_read_only_build_token' => false]);
});