Skip to content

How about changing interpretation of version string #447

Description

@znz

Many users who wants use 3.0.x write ruby-version: 3.0 by mistake.

3.0 interpreted as 3 on GitHub Actions.

For example, following workflow step prints 3 only.

        env:
          env_var: 3.0
        run: |
          set -x
          echo ${env_var}

So I propose changing the meaning of 3 (and 3.0 on workflow files) use 3.0.x, and 3.x (or something) use latest 3.x.x.

After this change, many users can write 3.0 intentionally, and some (probably less) users who want use latest 3.x.x can write 3.x or something instead.

Activity

  1. znz commented on Jan 17, 2023

    @znz
    MemberAuthor

    In actions/runner#849 , 3.10 is another problem.
    And ruby's yaml parser also parses 3.10 as 3.1 too.
    But ruby's yaml parser parses 3.0 as 3.0, so it is more important difference.

  2. eregon commented on Jan 17, 2023

    @eregon
    Member

    I thought about this too in the past, but it means there is no way to express "Ruby >= 3 < 4" then, i.e. Ruby 3.x.
    I'm kind of negative to introduce such hacks and exceptions, because it can lead to more confusion and inconsistency.

    I still think this is a bug of the GitHub Actions YAML parser, because it can know the difference but doesn't use it.
    No idea if it will ever be fixed though.
    An alternative might be if an action can get its inputs as the original strings in YAML, not parsed to numbers or anything. That would also work. core.getInput() is already always a string, but it is value.toString vs the original string.

    .10 is not an issue as few Ruby versions have a .10, and those that do have it have it as patch so then it's not a float anymore anyway (e.g. 2.4.10).

  3. eregon commented on Jan 24, 2023

    @eregon
    Member

    I filed actions/toolkit#1320, if that's done that would be enough.

  4. eregon commented on Jan 24, 2023

    @eregon
    Member

    Another idea is maybe we could warn when we get 3 as the input.
    And then we could say use ruby-3 if you really want CRuby >= 3 < 4, that's actually a fairly simple alternative way to express CRuby >= 3 < 4.

  5. eliduke commented on Mar 6, 2024

    @eliduke

    In actions/runner#849 , 3.10 is another problem. And ruby's yaml parser also parses 3.10 as 3.1 too. But ruby's yaml parser parses 3.0 as 3.0, so it is more important difference.

    I was just reading about this as well, looks like the solution is to just wrap it in single quotes as such:

    env:
      env_var: '3.0'

    Should fix the problem for now at least!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions