From 778a0a0e98b1e8bd6fa6618f320d097789bd8601 Mon Sep 17 00:00:00 2001 From: Leonel Enriquez Date: Tue, 30 Apr 2024 10:00:18 -0500 Subject: [PATCH] Issue #535: Code Refactor --- src/ScaffoldInstallerPlugin.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/ScaffoldInstallerPlugin.php b/src/ScaffoldInstallerPlugin.php index 6d4136f4d..038bb94dd 100644 --- a/src/ScaffoldInstallerPlugin.php +++ b/src/ScaffoldInstallerPlugin.php @@ -282,26 +282,16 @@ private function installCICommands(): void $fs->ensureDirectoryExists('./.github/actions'); $fs->copy("$scaffoldPath/github/actions/common", './.github/actions/drainpipe'); foreach ($this->extra['drainpipe']['github'] as $github) { - if ($github === 'PantheonReviewApps') { + if ($github === 'PantheonReviewApps' || $github === 'PantheonReviewAppsManual') { $fs->ensureDirectoryExists('./.github/actions/drainpipe/pantheon'); $fs->ensureDirectoryExists('./.github/workflows'); $fs->copy("$scaffoldPath/github/actions/pantheon", './.github/actions/drainpipe/pantheon'); + $is_manual = $github === 'PantheonReviewAppsManual' ? 'Manual' : ''; if (file_exists('./.ddev/config.yaml')) { - $fs->copy("$scaffoldPath/github/workflows/PantheonReviewAppsDDEV.yml", './.github/workflows/PantheonReviewApps.yml'); + $fs->copy("$scaffoldPath/github/workflows/PantheonReviewAppsDDEV$is_manual.yml", './.github/workflows/PantheonReviewApps.yml'); } else { - $fs->copy("$scaffoldPath/github/workflows/PantheonReviewApps.yml", './.github/workflows/PantheonReviewApps.yml'); - } - } - else if ($github === 'PantheonReviewAppsManual') { - $fs->ensureDirectoryExists('./.github/actions/drainpipe/pantheon'); - $fs->ensureDirectoryExists('./.github/workflows'); - $fs->copy("$scaffoldPath/github/actions/pantheon", './.github/actions/drainpipe/pantheon'); - if (file_exists('./.ddev/config.yaml')) { - $fs->copy("$scaffoldPath/github/workflows/PantheonReviewAppsDDEVManual.yml", './.github/workflows/PantheonReviewApps.yml'); - } - else { - $fs->copy("$scaffoldPath/github/workflows/PantheonReviewAppsManual.yml", './.github/workflows/PantheonReviewApps.yml'); + $fs->copy("$scaffoldPath/github/workflows/PantheonReviewApps$is_manual.yml", './.github/workflows/PantheonReviewApps.yml'); } } else if ($github === 'ComposerLockDiff') {