Skip to content

Commit

Permalink
Fix suggestios done in code review
Browse files Browse the repository at this point in the history
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
  • Loading branch information
elpic committed May 31, 2023
1 parent 892baae commit 3d009a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ jobs:
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.
If both the python-version and the python-version-file inputs are provided then the python-version input is used.

> The action will search for the python version file relative to the repository root.
> 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.

```yaml
steps:
Expand Down
11 changes: 3 additions & 8 deletions src/setup-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@ function resolveVersionInput() {
}

if (versionFile) {
const versionFilePath = path.join(
process.env.GITHUB_WORKSPACE!,
versionFile
);

if (!fs.existsSync(versionFilePath)) {
if (!fs.existsSync(versionFile)) {
throw new Error(
`The specified python version file at: ${versionFilePath} doesn't exist.`
`The specified python version file at: ${versionFile} doesn't exist.`
);
}

const version = parsePythonVersionFile(fs.readFileSync(versionFilePath, 'utf8'));
const version = parsePythonVersionFile(fs.readFileSync(versionFile, 'utf8'));
core.info(`Resolved ${versionFile} as ${version}`);

return [version];
Expand Down

0 comments on commit 3d009a5

Please sign in to comment.