{"id":13515564,"url":"https://github.com/ruby/setup-ruby","last_synced_at":"2026-01-18T23:08:18.257Z","repository":{"id":37540776,"uuid":"231208785","full_name":"ruby/setup-ruby","owner":"ruby","description":"An action to download a prebuilt Ruby and add it to the PATH in 5 seconds","archived":false,"fork":false,"pushed_at":"2026-01-10T14:05:22.000Z","size":26939,"stargazers_count":946,"open_issues_count":13,"forks_count":358,"subscribers_count":26,"default_branch":"master","last_synced_at":"2026-01-11T04:20:21.474Z","etag":null,"topics":["actions","jruby","mri","prebuilt-rubies","prebuilt-ruby","ruby-action","truffleruby"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["eregon"]}},"created_at":"2020-01-01T11:39:25.000Z","updated_at":"2026-01-10T14:31:54.000Z","dependencies_parsed_at":"2023-12-11T16:31:12.720Z","dependency_job_id":"5f3ead09-a052-44e8-a252-74f67d580307","html_url":"https://github.com/ruby/setup-ruby","commit_stats":{"total_commits":718,"total_committers":63,"mean_commits":"11.396825396825397","dds":"0.34122562674094703","last_synced_commit":"a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc"},"previous_names":[],"tags_count":338,"template":false,"template_full_name":"actions/javascript-action","purl":"pkg:github/ruby/setup-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsetup-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsetup-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsetup-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsetup-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby","download_url":"https://codeload.github.com/ruby/setup-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby%2Fsetup-ruby/sbom","scorecard":{"id":552998,"data":{"date":"2025-08-11","repo":{"name":"github.com/ruby/setup-ruby","commit":"829114fc20da43a41d27359103ec7a63020954d4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.7,"checks":[{"name":"Maintained","score":10,"reason":"27 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":8,"reason":"Found 17/21 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/release.yml:5","Info: topLevel 'contents' permission set to 'read': .github/workflows/test.yml:13","Warn: topLevel 'contents' permission set to 'write': .github/workflows/update-v1-branch.yml:6","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Info: Possibly incomplete results: error parsing shell code: a command can only contain words and redirects; encountered (: .github/workflows/test.yml:120","Info: Possibly incomplete results: error parsing shell code: \"foo(\" must be followed by ): .github/workflows/test.yml:188","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:209: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:227: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:292: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:359: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:218: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:247: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:303: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:326: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:372: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:384: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:402: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:415: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:236: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:270: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:315: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:337: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:348: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:438: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:281: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:426: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-v1-branch.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/ruby/setup-ruby/update-v1-branch.yml/master?enable=pin","Info:   0 out of  23 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T11:27:00.304Z","repository_id":37540776,"created_at":"2025-08-20T11:27:00.307Z","updated_at":"2025-08-20T11:27:00.307Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28553070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","jruby","mri","prebuilt-rubies","prebuilt-ruby","ruby-action","truffleruby"],"created_at":"2024-08-01T05:01:12.908Z","updated_at":"2026-01-18T23:08:18.244Z","avatar_url":"https://github.com/ruby.png","language":"JavaScript","readme":"# setup-ruby\n\nThis action downloads a prebuilt ruby and adds it to the `PATH`.\n\nIt is very efficient and takes about 5 seconds to download, extract and add the given Ruby to the `PATH`.\nNo extra packages need to be installed.\n\n**Important:** Prefer `ruby/setup-ruby@v1`.\nIf you pin to a commit or release, only the Ruby versions available at the time of the commit\nwill be available, and you will need to update it to use newer Ruby versions, see [Versioning](#versioning).\n\n### Supported Versions\n\nThis action currently supports these versions of MRI, JRuby and TruffleRuby:\n\n| Interpreter | Versions |\n| ----------- | -------- |\n| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 4.0.1, head, debug, mingw, mswin, ucrt |\n| `jruby` | 9.1.17.0 - 10.0.2.0, head |\n| `truffleruby` | 19.3.0 - 33.0.0, head |\n| `truffleruby+graalvm` | 21.2.0 - 33.0.0, head |\n\n`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).\n\n`ruby-asan` is the same as `ruby-head` but with AddressSanitizer (ASan) enabled, helpful for finding memory issues in native extensions.\nNative extensions are automatically compiled with AddressSanitizer when using `ruby-asan`.\n`ruby-asan` is currently only available on `ubuntu-24.04`.\n\n`asan-release` is similar to `ruby-asan` but built from the latest stable release tag.\nLike `ruby-asan`, it's currently only available on `ubuntu-24.04`.\n\nRegarding Windows ruby master builds, `mingw` is a MSYS2/MinGW build, `head` \u0026 `ucrt` are MSYS2/UCRT64\nbuilds, and `mswin` is a MSVC/VS 2022 build.\n\nPreview and RC versions of Ruby might be available too on Ubuntu and macOS (not on Windows).\nHowever, it is recommended to test against `ruby-head` rather than previews,\nas it provides more useful feedback for the Ruby core team and for upcoming changes.\n\nOnly release versions published by [RubyInstaller](https://rubyinstaller.org/downloads/archives/)\nare available on Windows.  Due to that, Ruby 2.2 resolves to 2.2.6 on Windows and 2.2.10\non other platforms. Ruby 2.3 on Windows only has builds for 2.3.0, 2.3.1 and 2.3.3.\n\nNote that Ruby ≤ 2.4 and the OpenSSL version it needs (1.0.2) are both end-of-life,\nwhich means Ruby ≤ 2.4 is unmaintained and considered insecure.\n\n### Supported Platforms\n\nThe action works on these [GitHub-hosted runners](https://docs.github.com/en/actions/reference/runners/github-hosted-runners) images. Runner images not listed below are not supported yet. `$OS-latest` just alias to one of these images.\n\n| Operating System | Supported |\n| ---------------- | --------- |\n| Ubuntu  | `ubuntu-22.04`, `ubuntu-24.04`, `ubuntu-22.04-arm`, `ubuntu-24.04-arm` |\n| macOS   | `macos-14` and newer versions |\n| Windows | `windows-2022`, `windows-2025`, `windows-11-arm` |\n\nNot all combinations of runner images and versions are supported.\nThe list of available Ruby versions can be seen in [ruby-builder-versions.json](ruby-builder-versions.json) for Ubuntu and macOS\n(although some combinations are not available, see [the full list](https://github.com/ruby/ruby-builder/releases/tag/toolcache))\nand in [windows-versions.json](windows-versions.json) for Windows.\n\nThe prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)\nand on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).\nThe `mingw`, `ucrt` and `mswin` builds are generated by [ruby-loco](https://github.com/MSP-Greg/ruby-loco).\n`ruby-head` is generated by [ruby-dev-builder](https://github.com/ruby/ruby-dev-builder),\n`jruby-head` is generated by [jruby-dev-builder](https://github.com/ruby/jruby-dev-builder),\n`truffleruby-head` and `truffleruby+graalvm-head` are generated by [truffleruby-dev-builder](https://github.com/ruby/truffleruby-dev-builder).\n\n## Usage\n\n### Single Job\n\n```yaml\nname: My workflow\non: [push, pull_request]\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v5\n    - uses: ruby/setup-ruby@v1\n      with:\n        ruby-version: '3.4' # Not needed with a .ruby-version, .tool-versions or mise.toml\n        bundler-cache: true # runs 'bundle install' and caches installed gems automatically\n    - run: bundle exec rake\n```\n\n### Matrix of Ruby Versions\n\nThis matrix tests all stable releases and `head` versions of MRI, JRuby and TruffleRuby on Ubuntu and macOS.\n\n```yaml\nname: My workflow\non: [push, pull_request]\njobs:\n  test:\n    strategy:\n      fail-fast: false\n      matrix:\n        os: [ubuntu-latest, macos-latest]\n        # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'\n        ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', head, jruby, jruby-head, truffleruby, truffleruby-head]\n    runs-on: ${{ matrix.os }}\n    steps:\n    - uses: actions/checkout@v5\n    - uses: ruby/setup-ruby@v1\n      with:\n        ruby-version: ${{ matrix.ruby }}\n        bundler-cache: true # runs 'bundle install' and caches installed gems automatically\n    - run: bundle exec rake\n```\n\n### Matrix of Gemfiles\n\n```yaml\nname: My workflow\non: [push, pull_request]\njobs:\n  test:\n    strategy:\n      fail-fast: false\n      matrix:\n        gemfile: [ rails7, rails8 ]\n    runs-on: ubuntu-latest\n    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps\n      BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile\n    steps:\n      - uses: actions/checkout@v5\n      - uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: '3.4'\n          bundler-cache: true # runs 'bundle install' and caches installed gems automatically\n      - run: bundle exec rake\n```\n\nSee the GitHub Actions documentation for more details about the\n[workflow syntax](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions)\nand the [condition and expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions).\n\n### Supported Version Syntax\n\n* engine-version like `ruby-2.6.5` and `truffleruby-19.3.0`\n* short version like `'2.6'`, automatically using the latest release matching that version (`2.6.10`)\n* version only like `'2.6.5'`, assumes MRI for the engine\n* engine only like `ruby` and `truffleruby`, uses the latest stable release of that implementation\n* `.ruby-version` reads from the project's `.ruby-version` file\n* `.tool-versions` reads from the project's `.tool-versions` file\n* `mise.toml` reads from the project's `mise.toml` file\n* If the `ruby-version` input is not specified, `.ruby-version` is tried first, followed by `.tool-versions`, followed by `mise.toml`\n\n### Working Directory\n\nThe `working-directory` input can be set to resolve `.ruby-version`, `.tool-versions`, `mise.toml` and `Gemfile.lock`\nif they are not at the root of the repository, see [action.yml](action.yml) for details.\n\n### RubyGems\n\nBy default, the default RubyGems version that comes with each Ruby is used.\nHowever, users can optionally customize the RubyGems version that they want by\nsetting the `rubygems` input.\n\nSee [action.yml](action.yml) for more details about the `rubygems` input.\n\nIf you're running into `ArgumentError: wrong number of arguments (given 4,\nexpected 1)` errors with a stacktrace including Psych and RubyGems entries, you\nshould be able to fix them by setting `rubygems: 3.0.0` or higher.\n\n### Bundler\n\nBy default, Bundler is installed as follows:\n\n* If there is a `Gemfile.lock` file (or `$BUNDLE_GEMFILE.lock` or `gems.locked`) with a `BUNDLED WITH` section,\n  that version of Bundler will be installed and used.\n* If the Ruby ships with Bundler 2.2+ (as a default gem), that version is used.\n* Otherwise, the latest compatible Bundler version is installed (Bundler 2 on Ruby \u003e= 2.3, Bundler 1 on Ruby \u003c 2.3).\n\nThis behavior can be customized, see [action.yml](action.yml) for more details about the `bundler` input.\n\n### Caching `bundle install` automatically\n\nThis action provides a way to automatically run `bundle install` and cache the result:\n```yaml\n    - uses: ruby/setup-ruby@v1\n      with:\n        bundler-cache: true\n```\n\nNote that any step doing `bundle install` (for the root `Gemfile`) or `gem install bundler` can be removed with `bundler-cache: true`.\n\nThis caching speeds up installing gems significantly and avoids too many requests to RubyGems.org.  \nIt needs a `Gemfile` (or `$BUNDLE_GEMFILE` or `gems.rb`) under the [`working-directory`](#working-directory).  \nIf there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bundle config --local deployment true` is used.\n\nTo use a `Gemfile` which is not at the root or has a different name, set `BUNDLE_GEMFILE` in the `env` at the job level\nas shown in the [example](#matrix-of-gemfiles).\n\n#### bundle config\n\nWhen using `bundler-cache: true` you might notice there is no good place to run `bundle config ...` commands.\nThese can be replaced by `BUNDLE_*` environment variables, which are also faster.\nThey should be set in the `env` at the job level as shown in the [example](#matrix-of-gemfiles).\nTo find the correct the environment variable name, see the [Bundler docs](https://bundler.io/man/bundle-config.1.html) or look at `.bundle/config` after running `bundle config --local KEY VALUE` locally.\nYou might need to `\"`-quote the environment variable name in YAML if it has unusual characters like `/`.\n\nTo perform caching, this action will use `bundle config --local path $PWD/vendor/bundle`.  \nTherefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).\n\n#### How it Works\n\nWhen there is no lockfile, one is generated with `bundle lock`, which is the same as `bundle install` would do first before actually fetching any gem.\nIn other words, it works exactly like `bundle install`.\nThe hash of the generated lockfile is then used for caching, which is the only correct approach.\n\n#### Dealing with a corrupted cache\n\nIn some rare scenarios (like using gems with C extensions whose functionality depends on libraries found on the system\nat the time of the gem's build) it may be necessary to ignore contents of the cache and get and build all the gems anew.\nIn order to achieve this, set the `cache-version` option to any value other than `0` (or change it to a new unique value\nif you have already used it before.)\n\n```yaml\n    - uses: ruby/setup-ruby@v1\n      with:\n        bundler-cache: true\n        cache-version: 1\n```\n\n#### Caching `bundle install` manually\n\nIt is also possible to cache gems manually, but this is not recommended because it is verbose and *very difficult* to do correctly.\nThere are many concerns which means using `actions/cache` is never enough for caching gems (e.g., incomplete cache key, cleaning old gems when restoring from another key, correctly hashing the lockfile if not checked in, OS versions, ABI compatibility for `ruby-head`, etc).\nSo, please use `bundler-cache: true` instead and report any issue.\n\n### Authentication Token\n\nBy default, this action uses `${{ github.token }}` to authenticate when downloading Ruby release assets from GitHub.\nThis helps avoid rate limiting issues.\n\nIf you're running this action on a GitHub Enterprise Server (GHES) instance, or if you're experiencing rate limiting,\nyou can provide a custom token:\n\n```yaml\n    - uses: ruby/setup-ruby@v1\n      with:\n        token: ${{ secrets.MY_GITHUB_TOKEN }}\n```\n\nIn most cases, you don't need to set this input as the default value is sufficient for use on github.com.\n\n## Windows\n\nNote that running CI on Windows can be quite challenging if you are not very familiar with Windows.\nIt is recommended to first get your build working on Ubuntu and macOS before trying Windows.\n\n* Use Bundler 2.2.18+ on Windows (older versions have [bugs](https://github.com/ruby/setup-ruby/issues/209#issuecomment-889064123)) by not setting the `bundler:` input and ensuring there is no `BUNDLED WITH 1.x.y` in a checked-in `Gemfile.lock`.\n* The default shell on Windows is not Bash but [PowerShell](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell).\n  This can lead issues such as multi-line scripts [not working as expected](https://github.com/ruby/setup-ruby/issues/13).\n* The `PATH` contains [multiple compiler toolchains](https://github.com/ruby/setup-ruby/issues/19). Use `where.exe` to debug which tool is used.\n* For Ruby ≥ 2.4, MSYS2 is prepended to the `Path`, similar to what RubyInstaller2 does.\n* For Ruby \u003c 2.4, the DevKit MSYS tools are installed and prepended to the `Path`.\n* Use JRuby 9.2.20+ on Windows (older versions have [bugs](https://github.com/ruby/setup-ruby/issues/18#issuecomment-889072695)).\n* JRuby on Windows has multiple issues ([jruby/jruby#7106](https://github.com/jruby/jruby/issues/7106), [jruby/jruby#7182](https://github.com/jruby/jruby/issues/7182)).\n* When compiling extension code, note that the packages required to build Ruby are included when using Windows 2022. Additional packages can be installed with [setup-ruby-pkgs](https://github.com/ruby/setup-ruby-pkgs) or via MSYS2's `pacman`. These packages may be required when installing or updating Ruby stdlib extension gems.\n\n## Versioning\n\nIt is highly recommended to use `ruby/setup-ruby@v1` for the version of this action.\nThis will provide the best experience by automatically getting bug fixes, new Ruby versions and new features.\n\nIf you instead choose a specific version (v1.2.3) or a commit sha, there will be no automatic bug fixes and\nit will be your responsibility to update every time the action no longer works.\nMake sure to always use the latest release before reporting an issue on GitHub.\n\nThis action follows semantic versioning with a moving `v1` branch.\nThis follows the [recommendations](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) of GitHub Actions.\n\n## Using self-hosted runners\n\nThis action might work with [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners)\nif the [Runner Image](https://github.com/actions/runner-images) is very similar to the ones used by GitHub runners. Notably:\n\n* Make sure to use the same operating system and version.\n* Make sure to use the same version of libssl.\n* Make sure that the operating system has `libyaml-0` and [`libgmp`](https://stackoverflow.com/questions/26555902/ruby-v-dyld-library-not-loaded-usr-local-lib-libgmp-10-dylib) installed\n* The default tool cache directory (`/opt/hostedtoolcache` on Linux, `/Users/runner/hostedtoolcache` on macOS,\n  `C:/hostedtoolcache/windows` on Windows) must be writable by the `runner` user.\n  This is necessary since the Ruby builds embed the install path when built and cannot be moved around.\n* `/home/runner` must be writable by the `runner` user.\n\nIn other cases, you will need to install Ruby in the runner tool cache as shown by the action when it detects that case\n(run it so it will show you where to install Ruby).\nYou could of course also not use this action and e.g. use Ruby from a system package or use a Docker image instead.\n\nSee also the [`self-hosted:` input](action.yml).\nYou can set it to `true` if you want to use custom-built Rubies in your self-hosted toolcache instead of prebuild Rubies.\n\n## History\n\nThis action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.\nPlease [update](https://github.com/ruby/setup-ruby/releases/tag/v1.13.0) if you are using `eregon/use-ruby-action`.\n\n## Credits\n\nThe current maintainer of this action is @eregon.\nMost of the Windows logic is based on work by MSP-Greg.\nMany thanks to MSP-Greg and Lars Kanis for the help with Ruby Installer.\n","funding_links":["https://github.com/sponsors/eregon"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fsetup-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby%2Fsetup-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby%2Fsetup-ruby/lists"}