Support all valid PHP version file values (#1121)

* Support all valid PHP version file values

Allow version files to use partial versions and aliases accepted by the
php-version input while preserving support for both plain .php-version
files and asdf-style php entries.

* Regenerate bundled action

---------

Co-authored-by: Shivam Mathur <shivam_jpr@hotmail.com>
This commit is contained in:
Sviatoslav Abakumov
2026-09-17 20:17:54 +05:30
committed by GitHub
co-authored by Shivam Mathur
parent e3f88f3ca7
commit 0bbee91078
3 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -535,7 +535,7 @@ export async function readPHPVersion(): Promise<string> {
(await getInput('php-version-file', false)) || '.php-version';
if (fs.existsSync(versionFile)) {
const contents: string = fs.readFileSync(versionFile, 'utf8');
const match = contents.match(/^(?:php\s)?(\d+\.\d+\.\d+)$/m);
const match = contents.match(/^(?:php\s)?(\S+)$/m);
return validatePHPVersionInput(
match ? match[1] : contents.trim(),
versionFile