From be99689f3dcb9abdbdcfc9b86311a89dce36506b Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Wed, 31 Aug 2022 16:08:15 -0400 Subject: [PATCH] ci: set --pr-id flag --- .ci/deploy/pantheon/dev-multidev | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.ci/deploy/pantheon/dev-multidev b/.ci/deploy/pantheon/dev-multidev index 86c71ff..aed3870 100755 --- a/.ci/deploy/pantheon/dev-multidev +++ b/.ci/deploy/pantheon/dev-multidev @@ -14,10 +14,15 @@ terminus build:gitignore:cut # Authenticate with Terminus terminus -n auth:login --machine-token="$TERMINUS_TOKEN" -if [[ $CI_BRANCH != $DEFAULT_BRANCH ]] +if [[ "$CI_BRANCH" != "$DEFAULT_BRANCH" ]] then - # Create a new multidev environment (or push to an existing one) - terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes + if [ -n "$PR_NUMBER" ]; then + # Create a new multidev environment (or push to an existing one) with PR id set + terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes --pr-id="$PR_NUMBER" + else + # Create a new multidev environment (or push to an existing one) + terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes + fi else # Push to the dev environment terminus -n build:env:push "$TERMINUS_SITE.dev" --yes @@ -37,10 +42,10 @@ fi terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- cr # Clear the environment cache -terminus -n env:clear-cache $TERMINUS_SITE.$TERMINUS_ENV +terminus -n env:clear-cache "$TERMINUS_SITE"."$TERMINUS_ENV" # Ensure secrets are set terminus -n secrets:set "$TERMINUS_SITE.$TERMINUS_ENV" token "${GH_TOKEN:-$GITHUB_TOKEN}" --file='.build-secrets/tokens.json' --clear --skip-if-empty # Delete old multidev environments associated # with a PR that has been merged or closed. -terminus -n build:env:delete:pr $TERMINUS_SITE --yes +terminus -n build:env:delete:pr "$TERMINUS_SITE" --yes