Skip to content

Commit

Permalink
fix: Error about missing .python-version file #1369 (#1370)
Browse files Browse the repository at this point in the history
* fix the default value of the perl-version-file input

* fallback to the default version 5

* npm run format
  • Loading branch information
shogo82148 authored Dec 12, 2022
1 parent c7b7e65 commit 7e22932
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/setup-perl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,19 @@ async function resolveVersionInput(): Promise<string> {
return version;
}

const versionFilePath = path.join(process.env.GITHUB_WORKSPACE || "", versionFile || ".python-version");
version = await fs.readFile(versionFilePath, "utf8");
core.info(`Resolved ${versionFile} as ${version}`);
return version;
try {
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE || "", versionFile || ".perl-version");
version = await fs.readFile(versionFilePath, "utf8");
core.info(`Resolved ${versionFile} as ${version}`);
return version;
} catch (err) {
if ((err as any)?.code !== "ENOENT" || versionFile) {
throw err;
}
}

// use the default version.
return "5";
}

run();

0 comments on commit 7e22932

Please sign in to comment.