-
Notifications
You must be signed in to change notification settings - Fork 988
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
Float 3.0 is misparsed as integer 3 in workflow YAML #849
Comments
@eregon I have faced with the same issue in my own action https://github.com/maxim-lobanov/setup-xcode and decided that the best solution is updating my action's readme to recommend customers to use quotes in inputs. I agree that the behavior that you have described looks a bit strange and it could be a bug. But I have found another problem if inputs are not quoted:
This input will be parsed as A few words from https://symfony.com/doc/current/components/yaml/yaml_format.html
So looks like that quoting is the best approach to save input as it is since strings can't be transformed somehow. (Please do not take my answer as official position of actions/runner owners 😃 . I don't have context how YAML parsing works under hood in GitHub Actions and just say from position of third-party action's owner who faced with the same issue) |
I agree for When I started the action I considered both options, and I chose the unquoted variant because it worked as far as I could see just as good, and it's a lot more concise. jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
ruby: [2.5, 2.6, 2.7, head, debug, jruby, jruby-head, truffleruby, truffleruby-head] and jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
ruby: ['2.5', '2.6', '2.7', 'head', 'debug', 'jruby', 'jruby-head', 'truffleruby', 'truffleruby-head'] I find the second one much harder to read. An example in another project: https://github.com/jeremyevans/sequel/pull/1742/files Also, as we can still see today, the unquoted versions were also used in TravisCI, which a lot of Ruby users come from: language: ruby
rvm:
- 2.5
- 2.6
- jruby
- truffleruby |
Wrap 3.0 version in single quotes. This is to avoid issues with interpreting the version identifier as `3` instead of `3.0`. Some more details here: actions/runner#849
Wrap 3.0 version in single quotes. This is to avoid issues with interpreting the version identifier as `3` instead of `3.0`. Some more details here: actions/runner#849
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/middleman/middleman/runs/1631689419?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just 3 as the input: ``` Run ruby/setup-ruby@v1 with: ruby-version: 3 ``` If we quote the version it works as expected, example at https://github.com/ruby/setup-ruby/runs/1617122299?check_suite_focus=true#step:3:3 ``` Run ./ with: ruby-version: 3.0 ```
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/middleman/middleman/runs/1631689419?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just 3 as the input: ``` Run ruby/setup-ruby@v1 with: ruby-version: 3 ``` If we quote the version it works as expected, example at https://github.com/ruby/setup-ruby/runs/1617122299?check_suite_focus=true#step:3:3 ``` Run ./ with: ruby-version: 3.0 ```
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 You can see that it says just `3`, not `3.0` at https://github.com/getsentry/sentry-ruby/runs/1775107213?check_suite_focus=true#step:4:4
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 You can see that it says just `3`, not `3.0` at https://github.com/getsentry/sentry-ruby/runs/1775107213?check_suite_focus=true#step:4:4
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/Shopify/graphql-batch/runs/1691443768?check_suite_focus=true#step:3:4 we can see that the setup-ruby action ran with just `3` as the input and not `3.0`.
The YAML parser seems at https://github.com/actions/runner/blob/main/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/YamlObjectReader.cs Probably NumberToken should keep a boolean flag for whether it's an integer or double, or to keep a String value if it's a double with no decimal part so it knows that converting it to string should be |
As described in the comment, due to a bug discussed on actions/runner#849, we currently have to use quotes for '3.0' as a workaround. This change makes it easy for people not to remove quotes as they misunderstand it's a typo.
As described in the comment, due to a bug discussed on actions/runner#849, we currently have to use quotes for '3.0' as a workaround. This change makes it easy for people not to remove quotes as they misunderstand it's a typo.
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/rack/rack/runs/2041788658?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just `3` as the input and not `3.0`.
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/rack/rack/runs/2041788658?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just `3` as the input and not `3.0`.
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/thoughtbot/climate_control/runs/2049131377?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just `3` as the input and not `3.0`.
To avoid unexpectedly stop testing Ruby 3.0 when Ruby 3.1 is released. See actions/runner#849 At https://github.com/thoughtbot/climate_control/runs/2049131377?check_suite_focus=true#step:3:3 we can see that the setup-ruby action ran with just `3` as the input and not `3.0`.
Another approach to solve this: actions/toolkit#1320 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. |
This issue does not seem to be a feature for the runner application, it concerns the GitHub actions platform more generally. Could you please post your feedback on the GitHub Community Support Forum which is actively monitored. Using the forum ensures that we route your feature request to the correct team. 😃 |
* CI against latest Rubies * Unlock `rake` version To support Ruby 3.2. * Show Ruby version in a Job name * `3.0` need quotes Ref: actions/runner#849
In order to work around a bug in GH Actions, it is required to wrap the 3.0 Ruby version declaration in quotes, otherwise it is interpreted as Ruby version 3, without major or minor version restrictions. See - official issue: actions/runner#849 - ruby/setup-ruby setup instructions: https://github.com/ruby/setup-ruby/tree/v1/?tab=readme-ov-file#matrix-of-ruby-versions
Describe the bug
3.0
in a workflow is misparsed as integer3
.Or at the very least, when it's parsed and then later converted to a string (with
${{ matrix.ruby }}
), it's3
and not the expected3.0
.To Reproduce
Expected behavior
The input log and the job name should indicate
3.0
, but we see3
instead:https://github.com/eregon/setup-ruby/runs/1503368422?check_suite_focus=true#step:3:3
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
The text was updated successfully, but these errors were encountered: