Fall back to sole Queue branch when Care branch names differ.
Deploy Ladill Care / deploy (push) Successful in 1m31s
Deploy Ladill Care / deploy (push) Successful in 1m31s
Free single-location Queue orgs often use a default name like Main Branch while Care stubs send Main; reuse the only branch. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -298,13 +298,19 @@ class QueueClient
|
||||
try {
|
||||
$this->ensureBranch($owner, ['name' => $branchName]);
|
||||
} catch (RequestException $e) {
|
||||
// Free Queue plans may already be at branch cap — continue if branch already exists.
|
||||
// Free Queue plans may already be at branch cap — continue if a branch can be resolved.
|
||||
if ($e->response?->status() !== 422) {
|
||||
throw $e;
|
||||
}
|
||||
$existing = collect($this->branches($owner))->first(
|
||||
$branches = collect($this->branches($owner));
|
||||
$existing = $branches->first(
|
||||
fn ($b) => strcasecmp((string) ($b['name'] ?? ''), $branchName) === 0
|
||||
);
|
||||
if (! $existing && $branches->count() === 1) {
|
||||
// Single-location Queue orgs often use a different default name (e.g. "Main Branch").
|
||||
$existing = $branches->first();
|
||||
$branchName = (string) ($existing['name'] ?? $branchName);
|
||||
}
|
||||
if (! $existing) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user