Float 3.0 is misparsed as integer 3 in workflow YAML
See original GitHub issueDescribe the bug
3.0
in a workflow is misparsed as integer 3
.
Or at the very least, when it’s parsed and then later converted to a string (with ${{ matrix.ruby }}
), it’s 3
and not the expected 3.0
.
To Reproduce
jobs:
test:
strategy:
matrix:
os: [ ubuntu-latest ]
ruby: [ 2.7, 3.0 ]
name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expected behavior
The input log and the job name should indicate 3.0
, but we see 3
instead:
https://github.com/eregon/setup-ruby/runs/1503368422?check_suite_focus=true#step:3:3
Run ./
with:
ruby-version: 3
bundler-cache: true
bundler: default
working-directory: .
This is important because ruby-version: 3.0
should pick version 3.0 but not version 3.1.
Due to this bug it would pick version 3.1.
I think in the YAML specification it’s clear that floats and integers are different, so they should be kept that way too in workflow YAMLS, including when passing through ${{ matrix.ruby }}
.
Using quotes [ 2.7, '3.0' ]
is a workaround, but it should be unnecessary and it’s much more verbose with many versions.
Runner Version and Platform
Version of your runner? 2.274.2 OS of the machine running the runner? Applies to all
Issue Analytics
- State:
- Created 3 years ago
- Reactions:29
- Comments:10 (1 by maintainers)
Top GitHub Comments
Another approach to solve this: https://github.com/actions/toolkit/issues/1320 That would even work for
3.10
, there is no CRuby version N.10 but nevertheless it would be a general solution to this problem, as @maxim-lobanov mentioned above.As one can see, there are hundreds of links to this issue, all workarounds for it, it’d be great to fix it, one way or another.
Is there a chance this could be fixed, i.e., to actually parse
3.0
as a float, just like3.1
is parsed as a float? Could someone from the GitHub Actions team comment if that seems reasonable to fix, or it would be impossible for compatibility to change this?