LoginSignup
5
0

More than 1 year has passed since last update.

GitHub Actionsでsetup-rubyが失敗するようになった

Posted at

GitHub Actions で actions/setup-ruby というアクションを利用していたのですが、ここ最近、必ず失敗するようになりました。

エラーメッセージはこんなかんじです。
image.png

Run actions/setup-ruby@v1
------------------------
NOTE: This action is deprecated and is no longer maintained.
Please, migrate to https://github.com/ruby/setup-ruby, which is being actively maintained.
------------------------
Error: Version 2.6.x not found

どうやら actions/setup-ruby は非推奨で、 ruby/setup-ruby へ移行すべきのようです。

actions/setup-ruby は保守が終了していた

念のため、 actions/setup-ruby のサイトを確認してみたところ、2022 年 11 月 9 日にアーカイブされていたことがわかりました。

image.png

ruby/setup-ruby へ移行する

私の場合、steps が以下のようになっていました。

steps:
  - uses: actions/checkout@v2
  - name: Set up Ruby
    uses: actions/setup-ruby@v1
    with:
      ruby-version: 2.6.x

これを以下のように変更すればよいようです。

steps:
  - uses: actions/checkout@v3
  - name: Set up Ruby
    uses: ruby/setup-ruby@v1
    with:
      ruby-version: 2.6.10

バージョン指定について

actions/setup-ruby では、 2.6.x のような表記に対応していましたが、 ruby/setup-ruby で同じ表記をすると、以下のようなエラーが出ました。

image.png

Run ruby/setup-ruby@v1

Error: Error: Unknown version 2.6.x for ruby on ubuntu-22.04
        available versions for ruby on ubuntu-22.04: 1.9.3-p551, 2.0.0-p648, 2.1.9, 2.2.10, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.9, 2.4.10, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9, 2.6.10, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 3.0.0-preview1, 3.0.0-preview2, 3.0.0-rc1, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1.0-preview1, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.2.0-preview1, 3.2.0-preview2, 3.2.0-preview3, 3.2.0-rc1, head, debug
        Make sure you use the latest version of the action with - uses: ruby/setup-ruby@v1
    at validateRubyEngineAndVersion (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68827:13)
    at setupRuby (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68728:19)
    at run (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68700:11)
    at /home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68861:40
    at /home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68863:3
    at Object.<anonymous> (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:68866:12)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

2.6.10 のように、厳密に指定したらエラーは消えました。

さいごに

本記事作成にあたり、以下のサイトを参考にさせていただきました。ありがとうございました!

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0