mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +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 () => {
|
it('checking resolveVersion', async () => {
|
||||||
await expect(utils.resolveVersion()).rejects.toThrow(
|
expect(await utils.resolveVersion()).toBe('latest');
|
||||||
"Neither 'php-version' nor 'php-version-file' inputs were supplied, and could not find '.php-version' file."
|
|
||||||
);
|
|
||||||
|
|
||||||
process.env['php-version-file'] = '.phpenv-version';
|
process.env['php-version-file'] = '.phpenv-version';
|
||||||
await expect(utils.resolveVersion()).rejects.toThrow(
|
await expect(utils.resolveVersion()).rejects.toThrow(
|
||||||
|
11
action.yml
11
action.yml
@ -6,25 +6,20 @@ branding:
|
|||||||
icon: 'play-circle'
|
icon: 'play-circle'
|
||||||
inputs:
|
inputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'Setup PHP version.'
|
description: 'Setup PHP version. Reads from .php-version if unset. Defaults to latest.'
|
||||||
default: '8.2'
|
php-version-file:
|
||||||
required: true
|
description: 'File containing the PHP version to use. Defaults to .php-version if unset.'
|
||||||
extensions:
|
extensions:
|
||||||
description: 'Setup PHP extensions.'
|
description: 'Setup PHP extensions.'
|
||||||
required: false
|
|
||||||
ini-file:
|
ini-file:
|
||||||
description: 'Set base ini file.'
|
description: 'Set base ini file.'
|
||||||
default: 'production'
|
default: 'production'
|
||||||
required: false
|
|
||||||
ini-values:
|
ini-values:
|
||||||
description: 'Add values to php.ini.'
|
description: 'Add values to php.ini.'
|
||||||
required: false
|
|
||||||
coverage:
|
coverage:
|
||||||
description: 'Setup code coverage driver.'
|
description: 'Setup code coverage driver.'
|
||||||
required: false
|
|
||||||
tools:
|
tools:
|
||||||
description: 'Setup popular tools globally.'
|
description: 'Setup popular tools globally.'
|
||||||
required: false
|
|
||||||
outputs:
|
outputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version in semver format'
|
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}`);
|
core.info(`Resolved ${versionFile} as ${version}`);
|
||||||
}
|
}
|
||||||
if (!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;
|
return version;
|
||||||
}
|
}
|
||||||
|
@ -446,9 +446,7 @@ export async function resolveVersion(): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error(
|
version = 'latest';
|
||||||
"Neither 'php-version' nor 'php-version-file' inputs were supplied, and could not find '.php-version' file."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
|
Loading…
Reference in New Issue
Block a user