Move php version default out of action.yml and update inputs #629 #690

This commit is contained in:
Steve Lacey 2023-01-29 16:09:30 +08:00
parent 2d47531473
commit b46c8e2a8c
4 changed files with 6 additions and 15 deletions

View File

@ -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(

View File

@ -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
View File

@ -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;
}

View File

@ -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;