- Notifications
You must be signed in to change notification settings - Fork0
A GitHub Action to run composer commands.
License
matchory/php-composer-action
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An action to runcomposer commands in a GitHub Actions workflow.
This action can be used to run any composer command. By default, it runscomposer install with sensible configurationout of the box:
name:Composer Action Exampleon:[ push ]jobs:composer:runs-on:ubuntu-lateststeps: -name:Checkout codeuses:actions/checkout@v4 -name:Run Composer Actionuses:actions/composer-action@v1
You can also specify a different command to run by using theargs input:
name:Composer Action Exampleon:[ push ]jobs:composer:runs-on:ubuntu-lateststeps: -name:Checkout codeuses:actions/checkout@v4 -name:Run Composer Actionuses:actions/composer-action@v1with:args:outdated --direct --format=json
The action has some common inputs:
| Input | Description | Required | Default |
|---|---|---|---|
args | Arguments to pass to composer. Accepts any valid Composer command args. Ifinstall (the default) orupdate, it will run the command with the configured option flags. | No | install |
verbosity | Set the verbosity level. Must be one of:normal,quiet,verbose,veryverbose", ordebug. | No | normal |
working-directory | The working directory to run the command in. | No | — |
no-plugins | Whether to disable plugins. | No | false |
no-scripts | Skips the execution of all scripts defined incomposer.json. | No | false |
It also provides additional convenience inputs that will only be applied with theinstall andupdate commands:
| Input | Description | Required | Default |
|---|---|---|---|
prefer | Specify package source preference. Must be one of:auto,dist, orsource. | No | auto |
no-dev | Disables installation of require-dev packages. | No | false |
autoloader | Configures autoloader generation. Must be one of:true,false,optimize,classma",orapcu`. | No | optimize |
audit | Run an audit after installation is complete. Also takes an audit format name. Must be one of:true (equivalent tosummary),false,table, orplain,json, orsummary. | No | false |
ignore-platform-reqs | Ignore platform requirements. Must be one of:true,false, or a comma-separated list of platform requirements to ignore. | No | false |
cache | Whether to use cache. | No | true |
artifact | Name of generated vendor artifact. | No | — |
artifact-path | Path of generated vendor artifact. | No | vendor.tar.gz |
artifact-retention-days | Number of days that the vendor artifact should be retained for. | No | 7 |
Some of the inputs are described in detail below.
| Output | Description |
|---|---|
artifact | Name of the generated vendor artifact. |
artifact-path | Path of generated vendor artifact. |
composer-cache-dir | Composer cache directory. |
Autoloader generation is enabled by default. You can configure this by setting theautoloader input to one of thefollowing values:
true- Generates the autoloader without optimizations (composer's default behavior).false- Disables autoloader generation (equivalent to passingno-autoloaderto composer).optimize- Generatesanoptimizedautoloader.classmap- Generatesanauthoritative class mapautoloader.apcu- GeneratesanAPCu autoloader.
Refer to theComposer documentation for more detailson autoloader generation and optimization levels.
The action can run an audit after installation is complete. This is enabled by setting theaudit input to one of thefollowing values:
true- Equivalent tosummary.false- Disables audit.table- Displays audit results in a table format.plain- Displays audit results in a plain text format.json- Displays audit results in a JSON format.summary- Displays audit results in a summary format.
This combines the--audit and--audit-format options. The default value isfalse, which disables the audit.
When enabled. The action will fail if the audit finds any issues.
The action can configure composer to ignore (some) platform requirements. This is enabled by setting theignore-platform-reqs input to one of the following values:
true- Ignores all platform requirements.false- Does not ignore any platform requirements (composer's default behavior).<comma-separated list>- Ignores the specified platform requirements. This can be a comma-separated list ofplatform requirements to ignore, such asext-curl,ext-json.
Refer to theComposer documentation for more
The action can use a cache to speed up installation. This is enabled by setting thecache input totrue (default)orfalse. If enabled, the action will use the cache directory specified by theCOMPOSER_CACHE_DIR environmentvariable. If this variable is not set, the action will use the default cache directory for Composer, which is$HOME/.composer/cache on Linux and macOS, and%LOCALAPPDATA%/Composer/cache on Windows.
The action can generate an artifact from the compressed vendor folder. This is enabled by setting theartifact inputtotrue. The archive will be generated in the working directory and will be namedvendor.tar.gz by default.
You can change the name of the artifact by setting theartifact-path input to a different path.
About
A GitHub Action to run composer commands.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.