Skip to content

Switch Pressable deployments to native Git API - #130

Open
tommusrhodus wants to merge 1 commit into
trunkfrom
feature/pressable-git
Open

Switch Pressable deployments to native Git API#130
tommusrhodus wants to merge 1 commit into
trunkfrom
feature/pressable-git

Conversation

@tommusrhodus

@tommusrhodus tommusrhodus commented May 31, 2026

Copy link
Copy Markdown
Contributor

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.

Summary by CodeRabbit

  • New Features

    • Added ability to connect Pressable sites to GitHub repositories via the Pressable Git API
    • New command enables connecting existing sites to GitHub repositories with optional automatic deployment
  • Documentation

    • Updated documentation with guidance on GitHub repository connections and deployment workflows for Pressable sites

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.
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This 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 pressable:connect-site-repository command enables manual site-to-repository connections. The existing pressable:create-site and pressable:clone-site commands are updated to use the Git API instead of DeployHQ for initial repository setup. Documentation is updated to explain the new native Git API workflow and confirm backward compatibility with existing DeployHQ-backed sites.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: migrating from DeployHQ to Pressable's native Git API for deployments, which is the primary objective across all modified and new files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
commands/Pressable_Site_Clone.php (1)

260-275: 💤 Low value

Consider 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(). Unlike connect_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

📥 Commits

Reviewing files that changed from the base of the PR and between 2dd426c and d50682c.

📒 Files selected for processing (5)
  • README.md
  • commands/Pressable_Site_Clone.php
  • commands/Pressable_Site_Create.php
  • commands/Pressable_Site_Repository_Connect.php
  • includes/functions-pressable.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant