Closed watarukura closed 1 year ago
@watarukura
go.mod
specifies the exact version, but it can be a range in composer.json
.
So it will need another input say php-version-preference
which takes an input highest
or lowest
, or minimum
or maximum
to resolve the range to an exact version. It can default to the highest version similar to how composer works.
If you would like to work on a PR to add this, please go ahead.
Similar actions like setup-node
and setup-python
have gone with pulling the version from a standalone file, that'd be great to see here rather than parsing out from composer.json which, as above, could be a range, and confusing.
In addition to allowing the file to be specified via php-version-file
, it'd also be good if there was a default file used if version has not been specified any other way e.g. .php-version
or .phpenv-version
.
Fwiw setup-node
supports .nvmrc
but does not default to it (and that's kinda annoying). The setup-python
action uses .python-version
if neither python-version
or python-version-file
is supplied and that is 👌🏼 when you're using the language across a few actions/steps and simply want consistency.
Symfony CLI uses .php-version
. Seems as good a choice as any. https://symfony.com/doc/current/setup/symfony_server.html#selecting-a-different-php-version
Describe the feature
for example actions/setup-go@v3, pick up Golang version from go.mod
I want to pick up PHP version from composer.json, like this
composer.json like this
Version
v2
.Underlying issue
When PHP version up, I must do same change to composer.json and GHA workflow yaml files.
Describe alternatives
Additional context
Are you willing to submit a PR?
I can try!