Skip to content

Commit 921c68c

Browse files
committed
Re-do CLI logic for github actions as multiple choices
1 parent 9c17254 commit 921c68c

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

console/create.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Console\Helper\QuestionHelper;
2323
use Symfony\Component\Console\Input\InputInterface;
2424
use Symfony\Component\Console\Output\OutputInterface;
25+
use Symfony\Component\Console\Question\ChoiceQuestion;
2526
use Symfony\Component\Console\Question\ConfirmationQuestion;
2627
use Symfony\Component\Console\Question\Question;
2728

@@ -167,6 +168,43 @@ protected function get_component_data()
167168
}
168169
}
169170

171+
// Special logic for GitHub Actions options
172+
if ($component === 'githubactions')
173+
{
174+
$question = $this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS') . $this->language->lang('COLON');
175+
$choices = [
176+
$this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_0'),
177+
$this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_1'),
178+
$this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_2'),
179+
];
180+
181+
$question = new ChoiceQuestion($question, $choices, 0);
182+
183+
$choice = $this->helper->ask($this->input, $this->output, $question);
184+
$index = array_search($choice, $choices, true);
185+
186+
$this->data['components']['githubactions'] = false;
187+
$this->data['components']['githubactions_deprecated'] = false;
188+
189+
if ($index === 1)
190+
{
191+
$this->data['components']['githubactions'] = true;
192+
}
193+
else if ($index === 2)
194+
{
195+
$this->data['components']['githubactions_deprecated'] = true;
196+
}
197+
198+
continue;
199+
}
200+
201+
if ($component === 'githubactions_deprecated')
202+
{
203+
// Already handled via githubactions logic
204+
continue;
205+
}
206+
207+
// Default logic for all other components
170208
$this->data['components'][$component] = $this->get_user_input('component_' . $component, $details['default']);
171209
}
172210
}

language/en/common.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
'SKELETON_QUESTION_COMPONENT_TESTS_UI' => 'Tests (PHPUnit)',
122122
'SKELETON_QUESTION_COMPONENT_TESTS_EXPLAIN' => 'Unit tests can test an extension to verify that specific portions of its source code work properly. This helps ensure basic code integrity and prevents regressions as an extension is being developed and debugged.',
123123
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a GitHub Actions workflow to run tests in your repository',
124+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_0' => 'No (Default)',
125+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_1' => 'Reusable (Recommended – uses phpBB’s maintained workflow)',
126+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_2' => 'Standalone (Deprecated – overrides reusable workflow)',
124127
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'GitHub Actions Workflow (Reusable – Recommended)',
125128
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_EXPLAIN' => 'Creates a GitHub Actions workflow that uses a reusable, phpBB-maintained framework to run PHPUnit tests on your repository. The workflow file is saved in .github/workflows and runs automatically on each commit and pull request.',
126129
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_DEPRECATED' => 'Create a standalone GitHub Actions workflow [Deprecated: not recommended unless you plan to modify jobs or steps]',

0 commit comments

Comments
 (0)