Skip to content

Commit bcf39c4

Browse files
committed
Fix suggestios done in code review
Rollback a not abot advanced usage on how to use the file and not use the GITHUB_WORKSPACE since it was removed in a previous PR
1 parent e0144aa commit bcf39c4

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

docs/advanced-usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ jobs:
242242
The python-version-file input accepts a path to a file containing the version of Python to be used by a project, for example .python-version, or .tool-versions.
243243
If both the python-version and the python-version-file inputs are provided then the python-version input is used.
244244

245-
> The action will search for the python version file relative to the repository root.
245+
> In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
246246

247247
```yaml
248248
steps:

src/setup-python.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,13 @@ function resolveVersionInput() {
3737
}
3838

3939
if (versionFile) {
40-
const versionFilePath = path.join(
41-
process.env.GITHUB_WORKSPACE!,
42-
versionFile
43-
);
44-
45-
if (!fs.existsSync(versionFilePath)) {
40+
if (!fs.existsSync(versionFile)) {
4641
throw new Error(
47-
`The specified python version file at: ${versionFilePath} doesn't exist.`
42+
`The specified python version file at: ${versionFile} doesn't exist.`
4843
);
4944
}
5045

51-
const version = parsePythonVersionFile(fs.readFileSync(versionFilePath, 'utf8'));
46+
const version = parsePythonVersionFile(fs.readFileSync(versionFile, 'utf8'));
5247
core.info(`Resolved ${versionFile} as ${version}`);
5348

5449
return [version];

0 commit comments

Comments
 (0)