Skip to content

Commit

Permalink
Move php version default out of action.yml and update inputs shivamma…
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Jan 29, 2023
1 parent 2d47531 commit b46c8e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 1 addition & 3 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 3 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b46c8e2

Please sign in to comment.