composer
composer copied to clipboard
the composer version cannot be defined more precisely than the "major" version
I tried to define the composer version as described here in the readme file.
If I only define the major-version the workflow file looks like this
name: Validate
on: [push]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Validate dependencies
uses: php-actions/[email protected]
with:
command: validate
php_version: "8.0.1"
version: 2
and the workflow passes
if I change the version to 2.2, 2.x or "2.2" they all fail.
The failed workflows can be seen below and the debug logs are also preserved in a private gist
Version | Workflow | Logs 2.2 | failed | log 2.x | failed | log "2.2" | failed | log
What am I doing wrong?
Hi, it looks like the original php-actions/composer install script uses a URL scheme that isn't supported for those version numbers, so will need updating to match the URL pattern used at getcomposer.org.
The script in question downloads the phar file:
https://github.com/php-actions/composer/blob/master/composer-action.bash#L7-L15
It seems the URL scheme should actually look like this:
- "latest" => https://getcomposer.org/download/latest-stable/composer.phar
- 2 => https://getcomposer.org/download/latest-2.x/composer.phar
- 2.2 => https://getcomposer.org/download/latest-2.2.x/composer.phar
- 2.2.2 => https://getcomposer.org/download/2.2.2/composer.phar
I'll update this functionality in the week, unless somebody supplies a PR earlier.
Hi,
thanks for taking a look into it. Since I'm unsure how to change the bash-code in a nice way (without many ugly elseifs) I'm not going to write a patch for this.
If you change the code, you might also want to support more/all options from https://getcomposer.org/download/ ?
- "latest" » https://getcomposer.org/download/latest-stable/composer.phar
- "Preview" » https://getcomposer.org/download/latest-preview/composer.phar
- "Snapshot" » https://getcomposer.org/composer.phar
- 1 / 1.x » https://getcomposer.org/download/latest-1.x/composer.phar
- 2 / 2.x » https://getcomposer.org/download/latest-2.x/composer.phar
- 2.2 / 2.2.x » https://getcomposer.org/download/latest-2.2.x/composer.phar
- exact version (even with RC, alpha, ...) » https://getcomposer.org/download/version/composer.phar
Good idea, I'll definitely mention this in the docs.
any updates on this topic?
Hey @Un1matr1x, sorry it's been so long but I've finally got around to this issue.
Please see https://github.com/php-actions/example-composer/runs/8196183608 for the current WIP tests. You can click through the various workflow steps that each request a different version using the version
parameter, and if you open up the output of each workflow, you'll see the precise version is properly getting loaded.
~~I think running so many tests at once from the same IP has timed something out, so I'll look into that next, but it's looking positive so far.~~ it just needed a few minutes to run completely :)
So, thank you @Un1matr1x - your bash skills have worked first time.
Seeing as the issue has been open for a while now, is there anything else you think would help?
If not, I will merge this in. Thank you so much for your contribution!
lgtm & I have no further ideas