|
| 1 | +.. include:: /Includes.rst.txt |
| 2 | + |
| 3 | +=========== |
| 4 | +PHP Command |
| 5 | +=========== |
| 6 | + |
| 7 | +The **PHP Command** workflow is a generic building block that sets up PHP, |
| 8 | +installs Composer dependencies, and runs a single arbitrary command. It is useful |
| 9 | +for one-off tasks that do not fit the specialized quality or test workflows — |
| 10 | +for example generating API documentation, running database migrations, or |
| 11 | +executing custom scripts. |
| 12 | + |
| 13 | +Inputs |
| 14 | +------ |
| 15 | + |
| 16 | +.. csv-table:: |
| 17 | + :header: "Input", "Type", "Default", "Description" |
| 18 | + |
| 19 | + "php-version", "string", "``8.2``", "PHP version to install." |
| 20 | + "command", "string", "*(required)*", "Command to run after ``composer install``." |
| 21 | + "php-extensions", "string", "``""""``", "Space-separated PHP extensions to install." |
| 22 | + "composer-args", "string", "``--no-interaction --no-progress --prefer-dist``", "Arguments passed to ``composer install``." |
| 23 | + "run-environment", "string", "``local``", "Value of the ``RUN_ENVIRONMENT`` env variable." |
| 24 | + |
| 25 | +Usage |
| 26 | +----- |
| 27 | + |
| 28 | +.. code-block:: yaml |
| 29 | + :caption: .github/workflows/generate-docs.yml |
| 30 | +
|
| 31 | + name: Generate API docs |
| 32 | + on: [push] |
| 33 | +
|
| 34 | + jobs: |
| 35 | + generate: |
| 36 | + uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-command.yml@main |
| 37 | + with: |
| 38 | + php-version: "8.3" |
| 39 | + command: "vendor/bin/generate-api-docs" |
| 40 | +
|
| 41 | +Custom Composer Arguments |
| 42 | +------------------------- |
| 43 | + |
| 44 | +Override the default Composer arguments when you need dev dependencies or a |
| 45 | +different install strategy: |
| 46 | + |
| 47 | +.. code-block:: yaml |
| 48 | +
|
| 49 | + with: |
| 50 | + command: "vendor/bin/rector process --dry-run" |
| 51 | + composer-args: "--no-interaction --no-progress" |
0 commit comments