mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-01-18 14:21:45 +07:00
Add support for composer files in sub-directory
This commit is contained in:
parent
cdfde5ebec
commit
84f76b1fc9
@ -416,6 +416,7 @@ Disable coverage for these reasons:
|
||||
- The `php-version-file` input if it exists
|
||||
- A `composer.lock` file and the `platform-overrides.php` value
|
||||
- A `composer.json` file and the `config.platform.php` value
|
||||
- If the `composer.lock` or `composer.json` file is in a sub-directory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
|
||||
|
||||
#### `php-version-file` (optional)
|
||||
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -441,7 +441,8 @@ export async function readPHPVersion(): Promise<string> {
|
||||
throw new Error(`Could not find '${versionFile}' file.`);
|
||||
}
|
||||
|
||||
const composerLock = 'composer.lock';
|
||||
const composerProjectDir = await readEnv('COMPOSER_PROJECT_DIR');
|
||||
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
||||
if (fs.existsSync(composerLock)) {
|
||||
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
||||
if (
|
||||
@ -452,7 +453,7 @@ export async function readPHPVersion(): Promise<string> {
|
||||
}
|
||||
}
|
||||
|
||||
const composerJson = 'composer.json';
|
||||
const composerJson = path.join(composerProjectDir, 'composer.json');
|
||||
if (fs.existsSync(composerJson)) {
|
||||
const composerFileContents = JSON.parse(
|
||||
fs.readFileSync(composerJson, 'utf8')
|
||||
|
Loading…
Reference in New Issue
Block a user