You may be running builds in Github Actions using the setup-ruby action to install a chosen version of ruby, looking something like this:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
A week ago, that would have installed the latest ruby 3.0.x. But as of the christmas release of ruby 3.1, it will install the latest ruby 3.1.x.
The workaround and/or correction is to quote the ruby version number. If you actually want to get latest ruby 3.0.x, say:
with:
ruby-version: '3.0'
This is reported here, with reference to this issue on the Github Actions runner itself. It is not clear to me that this is any kind of a bug in the github actions runner, rather than just an unanticipated consequence of using a numeric value in YAML here. 3.0
is of course the same number as 3
, it’s not obvious to me it’s a bug that the YAML parser treats them as such.
Perhaps it’s a bug or mis-design in the setup-ruby
action. But in lieu of any developers deciding it’s a bug… quote your 3.0
version number, or perhaps just quote all ruby version numbers with the setup-ruby task?
If your 3.0 builds started failing and you have no idea why — this could be it. It can be a bit confusing to diagnose, because I’m not sure anything in the Github Actions output will normally echo the ruby version in use? I guess there’s a clue in the “Installing Bundler” sub-head of the “Setup Ruby” task:

Of course it’s possible your build will succeed anyway on ruby 3.1 even if you meant to run it on ruby 3.0! Mine failed with LoadError: cannot load such file -- net/smtp
, so if yours happened to do the same, maybe you got here from google. :) (Clearly net/smtp has been moved to a different status of standard gem in ruby 3.1, I’m not dealing with this further becuase I wasn’t intentionally supporting ruby 3.1 yet).
Note that if you are building with a Github actions matrix for ruby version, the same issue applies. Maybe something like:
matrix:
include:
- ruby: '3.0'
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}