mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 03:41:06 +07:00
Merge pull request #691 from stevelacey/php-version-file-inputs
Move php version default out of action.yml and update inputs
This commit is contained in:
commit
686e8dfff9
@ -264,9 +264,7 @@ describe('Utils tests', () => {
|
||||
});
|
||||
|
||||
it('checking resolveVersion', async () => {
|
||||
await expect(utils.resolveVersion()).rejects.toThrow(
|
||||
"Neither 'php-version' nor 'php-version-file' inputs were supplied, and could not find '.php-version' file."
|
||||
);
|
||||
expect(await utils.resolveVersion()).toBe('latest');
|
||||
|
||||
process.env['php-version-file'] = '.phpenv-version';
|
||||
await expect(utils.resolveVersion()).rejects.toThrow(
|
||||
|
11
action.yml
11
action.yml
@ -6,25 +6,20 @@ branding:
|
||||
icon: 'play-circle'
|
||||
inputs:
|
||||
php-version:
|
||||
description: 'Setup PHP version.'
|
||||
default: '8.2'
|
||||
required: true
|
||||
description: 'Setup PHP version. Reads from .php-version if unset. Defaults to latest.'
|
||||
php-version-file:
|
||||
description: 'File containing the PHP version to use. Defaults to .php-version if unset.'
|
||||
extensions:
|
||||
description: 'Setup PHP extensions.'
|
||||
required: false
|
||||
ini-file:
|
||||
description: 'Set base ini file.'
|
||||
default: 'production'
|
||||
required: false
|
||||
ini-values:
|
||||
description: 'Add values to php.ini.'
|
||||
required: false
|
||||
coverage:
|
||||
description: 'Setup code coverage driver.'
|
||||
required: false
|
||||
tools:
|
||||
description: 'Setup popular tools globally.'
|
||||
required: false
|
||||
outputs:
|
||||
php-version:
|
||||
description: 'PHP version in semver format'
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -1298,7 +1298,7 @@ async function resolveVersion() {
|
||||
core.info(`Resolved ${versionFile} as ${version}`);
|
||||
}
|
||||
if (!version) {
|
||||
throw new Error("Neither 'php-version' nor 'php-version-file' inputs were supplied, and could not find '.php-version' file.");
|
||||
version = 'latest';
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
@ -446,9 +446,7 @@ export async function resolveVersion(): Promise<string> {
|
||||
}
|
||||
|
||||
if (!version) {
|
||||
throw new Error(
|
||||
"Neither 'php-version' nor 'php-version-file' inputs were supplied, and could not find '.php-version' file."
|
||||
);
|
||||
version = 'latest';
|
||||
}
|
||||
|
||||
return version;
|
||||
|
Loading…
Reference in New Issue
Block a user