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

Multiple Python versions as a comma-separated list #870

Open
paduszyk opened this issue May 17, 2024 · 1 comment
Open

Multiple Python versions as a comma-separated list #870

paduszyk opened this issue May 17, 2024 · 1 comment
Labels
feature request New feature or request to improve the current logic

Comments

@paduszyk
Copy link

Thanks for maintaining the project and considering my idea 🙂

Description:
Allowing the action to accept comma-separated lists of Python versions would enhance the user experience if the versions are passed dynamically, as an output from another job.

Justification:
Assume I would like to define multiple Python versions dynamically, e.g., by using a script get_python_versions.py that parses the pyproject.toml file (let us say, from classifiers or requires-python). The script prints the \n-separated list of strings to terminal:

$ python get_python_versions.py
3.9
3.10
3.11
3.12

Then I would like to use the script's output in the action. Since the action accepts newline-separated lists only, I have to do the following:

jobs:
  python-versions:
    runs-on: ubuntu-latest
    outputs:
      python-versions: ${{ steps.python-versions.outputs.python-versions }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
      - id: python-versions
        run: |
          echo "python-versions<<EOF" >> $GITHUB_OUTPUT
          echo "$(python get_python_versions.py)" >> $GITHUB_OUTPUT
          echo "EOF" >> $GITHUB_OUTPUT
  build:
    needs:
      - python-versions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ needs.python-versions.outputs.python-versions }}

This works nicely. But... Now assume that the script returns a comma-separated list:

$ python get_python_versions.py
3.9,3.10,3.11,3.12

If comma-separated lists were allowed as the action's input, the python-versions step would be more concise and less verbose:

      ...
      - id: python-versions
        run: |
          echo "python-versions=$(python get_python_versions.py)" >> $GITHUB_OUTPUT
      ...

Are you willing to submit a PR?

I'm not familiar with Node/JS, so I'm not sure whether I am capable of opening a PR.

@paduszyk paduszyk added feature request New feature or request to improve the current logic needs triage labels May 17, 2024
@aparnajyothi-y
Copy link
Contributor

Hello @paduszyk, Thank you for creating this feature request and we will get back to you once we have some feedback on this :)

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

2 participants