If neither HOME nor COMPOSER_HOME env vars are set, validate_composer will exit with non-zero but the error message is redirected to /dev/null.
I had to fork the repo, remove the output redirection to see the issue:
Error: The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
My suggestion would be to either add a check for HOME/COMPOSER_HOME being set and adding a targeted error message if not or to show the output of composer validate in case it fails.
The latter would also help with future issues composer validate might have.
Steps to reproduce
Ensure composer.json is valid by running composer validate locally.
Run composer-install in an env where HOME/COMPOSER_HOME are not set (e.g. in a self-hosted runner or maybe by unsetting them via env: [HOME: '', COMPOSER_HOME: ''])
See the action fail.
Expected behavior
composer-install finishes successfully.
Output
Run ${GITHUB_ACTION_PATH}/bin/composer_paths.sh \
Error: The composer.json file at './composer.json' does not validate; run 'composer validate' to check for errors
Error: Process completed with exit code 1.
Environment details
version of this package: 2.2.0
PHP version: 8.0, 8.1, 8.2
OS: Self-hosted runner with Linux x64 (Ubuntu 22.04 LTS)
Description
If neither
HOME
norCOMPOSER_HOME
env vars are set, validate_composer will exit with non-zero but the error message is redirected to/dev/null
. I had to fork the repo, remove the output redirection to see the issue:My suggestion would be to either add a check for HOME/COMPOSER_HOME being set and adding a targeted error message if not or to show the output of composer validate in case it fails.
The latter would also help with future issues composer validate might have.
Steps to reproduce
composer validate
locally.env: [HOME: '', COMPOSER_HOME: '']
)Expected behavior
composer-install finishes successfully.
Output
Environment details
Additional context
Complete tests.yaml