Switch Pressable deployments to native Git API - #130
Conversation
Migrate repository deployment flow from DeployHQ to Pressable's native Git API for new/connected sites. Updates: - README: Document Pressable GitHub deployments and new CLI usage. - commands/Pressable_Site_Create.php: Use Pressable Git API to connect repos and trigger initial deploys instead of creating DeployHQ projects/servers. - commands/Pressable_Site_Clone.php: Replace DeployHQ lookups with Pressable Git config handling; connect cloned sites to the repository/branch via the Pressable Git API. - Added commands/Pressable_Site_Repository_Connect.php: New CLI command (pressable:connect-site-repository) to connect a Pressable site to a GitHub repo and optionally queue an extra deploy. - includes/functions-pressable.php: Added helpers for site-git endpoints (get/connect/update/disconnect token, branches, deploy, history) and a convenience connector for stdClass site/repo objects. This removes automatic DeployHQ project/server creation for new/connected Pressable sites and centralizes repo connections via the Pressable Git API; existing DeployHQ-backed sites remain unaffected.
WalkthroughThis PR migrates Pressable site provisioning from DeployHQ-based deployment to native Pressable Git API-based deployment. It introduces new API wrapper functions for Git configuration, repository connection, token management, and deployment triggering. A new 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
commands/Pressable_Site_Clone.php (1)
260-275: 💤 Low valueConsider triggering a deploy after updating the branch.
When the clone inherits the parent's repository connection (line 263-268), only the branch is updated via
update_pressable_site_git_config(). Unlikeconnect_pressable_site_repository_for_site()which triggers an initial deploy, the update call may not deploy the new branch's code automatically. The cloned site could remain on the parent's branch content until a manual deploy is triggered.If an immediate deploy is desired after branch update, add a call to
trigger_pressable_site_git_deployment().💡 Optional fix to trigger deploy after branch update
if ( ! \is_null( $clone_git_config ) && ! empty( $clone_git_config->connected ) ) { // The clone inherited the parent's repository connection; just point it at the development branch. $update = update_pressable_site_git_config( $site_clone->id, array( 'branch' => $this->gh_repo_branch ) ); if ( \is_null( $update ) ) { $output->writeln( '<error>Failed to update the cloned site Git branch. You may need to connect it manually via `team51 pressable:connect-site-repository`.</error>' ); + } else { + // Trigger a deploy to pull the development branch content. + trigger_pressable_site_git_deployment( $site_clone->id ); } } else {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@commands/Pressable_Site_Clone.php` around lines 260 - 275, When the cloned site inherits the parent's repo connection you only call update_pressable_site_git_config($site_clone->id, array('branch' => $this->gh_repo_branch)) which may not trigger a deploy; after a successful update (i.e. $update is not null) call trigger_pressable_site_git_deployment($site_clone->id, $this->gh_repo_branch) and mirror the existing error handling pattern (write an <error> message if the trigger returns null) so the clone actually deploys the new branch like connect_pressable_site_repository_for_site() does.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@commands/Pressable_Site_Clone.php`:
- Around line 260-275: When the cloned site inherits the parent's repo
connection you only call update_pressable_site_git_config($site_clone->id,
array('branch' => $this->gh_repo_branch)) which may not trigger a deploy; after
a successful update (i.e. $update is not null) call
trigger_pressable_site_git_deployment($site_clone->id, $this->gh_repo_branch)
and mirror the existing error handling pattern (write an <error> message if the
trigger returns null) so the clone actually deploys the new branch like
connect_pressable_site_repository_for_site() does.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: af7cb673-7b8c-4d5c-ba1d-65e9986b6d95
📒 Files selected for processing (5)
README.mdcommands/Pressable_Site_Clone.phpcommands/Pressable_Site_Create.phpcommands/Pressable_Site_Repository_Connect.phpincludes/functions-pressable.php
Migrate repository deployment flow from DeployHQ to Pressable's native Git API for new/connected sites. Updates:
This removes automatic DeployHQ project/server creation for new/connected Pressable sites and centralizes repo connections via the Pressable Git API; existing DeployHQ-backed sites remain unaffected.
Summary by CodeRabbit
New Features
Documentation