Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A GitHub Action to run composer commands.

License

NotificationsYou must be signed in to change notification settings

matchory/php-composer-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An action to runcomposer commands in a GitHub Actions workflow.

Usage

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

Configuration

Inputs

The action has some common inputs:

InputDescriptionRequiredDefault
argsArguments to pass to composer. Accepts any valid Composer command args. Ifinstall (the default) orupdate, it will run the command with the configured option flags.Noinstall
verbositySet the verbosity level. Must be one of:normal,quiet,verbose,veryverbose", ordebug.Nonormal
working-directoryThe working directory to run the command in.No
no-pluginsWhether to disable plugins.Nofalse
no-scriptsSkips the execution of all scripts defined incomposer.json.Nofalse

It also provides additional convenience inputs that will only be applied with theinstall andupdate commands:

InputDescriptionRequiredDefault
preferSpecify package source preference. Must be one of:auto,dist, orsource.Noauto
no-devDisables installation of require-dev packages.Nofalse
autoloaderConfigures autoloader generation. Must be one of:true,false,optimize,classma",orapcu`.Nooptimize
auditRun an audit after installation is complete. Also takes an audit format name. Must be one of:true (equivalent tosummary),false,table, orplain,json, orsummary.Nofalse
ignore-platform-reqsIgnore platform requirements. Must be one of:true,false, or a comma-separated list of platform requirements to ignore.Nofalse
cacheWhether to use cache.Notrue
artifactName of generated vendor artifact.No
artifact-pathPath of generated vendor artifact.Novendor.tar.gz
artifact-retention-daysNumber of days that the vendor artifact should be retained for.No7

Some of the inputs are described in detail below.

Outputs

OutputDescription
artifactName of the generated vendor artifact.
artifact-pathPath of generated vendor artifact.
composer-cache-dirComposer cache directory.

Autoloader Generation

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-autoloader to composer).
  • optimize - Generatesanoptimizedautoloader.
  • classmap - Generatesanauthoritative class mapautoloader.
  • apcu - GeneratesanAPCu autoloader.

Refer to theComposer documentation for more detailson autoloader generation and optimization levels.

Audit

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.

Ignoring Platform Requirements

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

Cache

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.

Artifact

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

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp