diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 1c862cea..eb7449d8 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -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( diff --git a/action.yml b/action.yml index 7dabddfc..a38c5e54 100644 --- a/action.yml +++ b/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' diff --git a/dist/index.js b/dist/index.js index 7b238da1..f8c544ca 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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; } diff --git a/src/utils.ts b/src/utils.ts index 8e4f3b6e..4bdfbaec 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -446,9 +446,7 @@ export async function resolveVersion(): Promise { } 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;