Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The action fails if the .python-version (passed into python-version-file input) contains a comment #949

Open
2 of 5 tasks
nitrocode opened this issue Sep 22, 2024 · 3 comments
Labels
feature request New feature or request to improve the current logic

Comments

@nitrocode
Copy link

Description:
The workflow

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version-file: '.python-version'

The .python-version file

# This file is read by the terraform if var.runtime is unset
3.11

The error

  Version # This file is read by the terraform if var.runtime is unset
  3.11 was not found in the local cache
  Error: The version '# This file is read by the terraform if var.runtime is unset
  3.11' with architecture 'x64' was not found for Ubuntu 22.04.
  The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

Action version:
Latest v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Repro steps:
See above

Expected behavior:
Ignores the comments and only grabs the version

Actual behavior:
It doesn't ignore the comments

@priya-kinthali
Copy link
Contributor

Hello @nitrocode 👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

@olivierlefloch
Copy link

The same issue occurs if multiple versions of python are specified in the .python-version file.

@priya-kinthali
Copy link
Contributor

Hello 👋,
@nitrocode , The setup-python action does not currently support comments within the .python-version file, which is causing the error you encountered. We appreciate you bringing this to our attention and will consider incorporating comment support in future enhancements. In the meantime, please ensure that the .python-version file contains only the version number without any comments.
@olivierlefloch , Regarding specifying multiple versions in the .python-version file, there is an existing feature request to support listing multiple versions. We will consider this for future updates.

Thank you both for your inputs and helping us improve the setup-python action!

@priya-kinthali priya-kinthali added feature request New feature or request to improve the current logic and removed bug Something isn't working labels Sep 27, 2024
@priya-kinthali priya-kinthali removed their assignment Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

4 participants