-
Notifications
You must be signed in to change notification settings - Fork 15
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 #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:
- Truncate the PR number in the branch name generation to ensure it fits within the limit
- Pre-calculate the truncated name and use it consistently throughout the workflow
- 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:
- Single digit: PR Research existing templates and tools #1 →
pr-1(4 chars) ✓ - Double digit: PR Add composer lock diff support for GitHub projects #99 →
pr-99(5 chars) ✓ - Triple digit: PR How to ignore
doctrine/annotationsintask test:security? #999 →pr-999(6 chars) ✓ - 4 digits: PR #9999 →
pr-9999(7 chars) ✓ - 9 digits: PR #123456789 →
pr-123456789(12 chars) ✗ Would be truncated topr-12345678