Fix reading php version from file

This commit is contained in:
Shivam Mathur 2023-04-02 20:25:49 +05:30
parent bb16550379
commit 6bf279d08a
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 2 additions and 2 deletions

2
dist/index.js vendored
View File

@ -1289,7 +1289,7 @@ async function resolveVersion() {
}
const versionFile = (await getInput('php-version-file', false)) || '.php-version';
if (fs_1.default.existsSync(versionFile)) {
return fs_1.default.readFileSync(versionFile, 'utf8');
return fs_1.default.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
}
else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`);

View File

@ -435,7 +435,7 @@ export async function resolveVersion(): Promise<string> {
const versionFile =
(await getInput('php-version-file', false)) || '.php-version';
if (fs.existsSync(versionFile)) {
return fs.readFileSync(versionFile, 'utf8');
return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
} else if (versionFile !== '.php-version') {
throw new Error(`Could not find '${versionFile}' file.`);
}