Skip to content

Commit 7e22932

Browse files
authored
fix: Error about missing .python-version file #1369 (#1370)
* fix the default value of the perl-version-file input * fallback to the default version 5 * npm run format
1 parent c7b7e65 commit 7e22932

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/setup-perl.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,19 @@ async function resolveVersionInput(): Promise<string> {
106106
return version;
107107
}
108108

109-
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE || "", versionFile || ".python-version");
110-
version = await fs.readFile(versionFilePath, "utf8");
111-
core.info(`Resolved ${versionFile} as ${version}`);
112-
return version;
109+
try {
110+
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE || "", versionFile || ".perl-version");
111+
version = await fs.readFile(versionFilePath, "utf8");
112+
core.info(`Resolved ${versionFile} as ${version}`);
113+
return version;
114+
} catch (err) {
115+
if ((err as any)?.code !== "ENOENT" || versionFile) {
116+
throw err;
117+
}
118+
}
119+
120+
// use the default version.
121+
return "5";
113122
}
114123

115124
run();

0 commit comments

Comments
 (0)