Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Pantheon truncates multidev environment names to 11 characters, but the workflow continued using the untruncated name in subsequent commands, causing "environment not found" errors.

Changes

  • Pre-calculate truncated name: New step computes ${MULTIDEV_NAME:0:11} and stores in $TRUNCATED_MULTIDEV_NAME for consistent use
  • Replace all references: Updated 15 occurrences of pr-$DRAINPIPE_PR_NUMBER to use $TRUNCATED_MULTIDEV_NAME:
    • GitHub deployment environment name
    • Multidev creation, content cloning, git push operations
    • Workflow wait, update commands, environment URLs
  • Fix stale environment cleanup:
    • Truncate PR numbers in comparison: jq -r '.[] | ("pr-" + (.number|tostring))[0:11]'
    • Use grep -Fxq for exact line matching instead of bash array matching

Example

Before:

terminus multidev:create site.live pr-123456789 --yes
# Creates "pr-12345678" (truncated by Pantheon)
terminus env:clone-content site.live pr-123456789 --yes
# Error: environment "pr-123456789" not found

After:

TRUNCATED_MULTIDEV_NAME="pr-12345678"
terminus multidev:create site.live $TRUNCATED_MULTIDEV_NAME --yes
terminus env:clone-content site.live $TRUNCATED_MULTIDEV_NAME --yes
# Works correctly
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix Pantheon Review App multidev name truncation mismatch</issue_title>
<issue_description>## Problem

The "Deploy Pantheon Review App" GitHub Action fails when the branch/multidev name exceeds Pantheon's 11-character limit for environment names.

Error Example

Notice: ] Created Multidev environment "pr-testdepl"
Error: ]  Could not find an environment identified by pr-testdeploy. 
Failed to execute command `terminus env:clone-content ***.live pr-testdeploy --yes`: exit status 1
Pantheon puts an 11 character limit on env names. Your name has been truncated to: pr-testdepl
Error: Process completed with exit code 1.

Root Cause

The workflow in scaffold/github/actions/pantheon/review/action.yml uses pr-$DRAINPIPE_PR_NUMBER as both:

  • The multidev environment name (created via terminus multidev:create)
  • The git branch name to push code to

When PR numbers have many digits (e.g., PR #testdeploy or PR Lullabot/drainpipe#12345678), the resulting name exceeds 11 characters. Pantheon automatically truncates the multidev environment name to 11 characters, but subsequent commands still reference the untruncated name, causing failures.

Proposed Solution

Standardize on the pr-### naming pattern that's already used in other workflows (see GitLab CI implementation in scaffold/gitlab/PantheonReviewApps.gitlab-ci.yml which uses mr-$CI_MERGE_REQUEST_IID).

Options:

  1. Truncate the PR number in the branch name generation to ensure it fits within the limit
  2. Pre-calculate the truncated name and use it consistently throughout the workflow
  3. Query Pantheon for the actual environment name after creation and use that

The most reliable approach would be to query the created multidev environment name from Pantheon immediately after creation and store it in an environment variable for use in subsequent steps.

Files Affected

  • scaffold/github/actions/pantheon/review/action.yml (lines 105-122 specifically)
    • Line 105-106: Checking if environment exists
    • Line 108: Wiping existing environment
    • Line 110: Creating multidev
    • Line 113: Cloning content
    • Line 121: Setting connection
    • Line 122: Pushing to git branch
    • Line 130: Waiting for workflow
    • Line 132-138: Running updates
    • Line 140: Constructing environment URL
    • Line 143: Locking environment

All references to pr-$DRAINPIPE_PR_NUMBER need to use the truncated name consistently.

Testing

Test with PR numbers that would create names exceeding 11 characters:

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 4, 2025 19:24
Co-authored-by: mrdavidburns <287035+mrdavidburns@users.noreply.github.com>
Co-authored-by: mrdavidburns <287035+mrdavidburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Pantheon Review App multidev name truncation mismatch Fix Pantheon multidev name truncation mismatch Dec 4, 2025
Copilot AI requested a review from mrdavidburns December 4, 2025 19:31
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.

Fix Pantheon Review App multidev name truncation mismatch

2 participants