Skip to content

Commit

Permalink
Fix reading php version from file
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Apr 2, 2023
1 parent bb16550 commit 6bf279d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}
Expand Down

0 comments on commit 6bf279d

Please sign in to comment.