From 4d7e038419d630a22fa46e6fbc61039574d83fbc Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 27 Nov 2020 11:03:17 +0100 Subject: [PATCH] Show how to set BUNDLE_GEMFILE in the README --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index ab69530..fb9b5d1 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,23 @@ This caching speeds up installing gems significantly and avoids too many request It needs a `Gemfile` (or `$BUNDLE_GEMFILE` or `gems.rb`) under the [`working-directory`](#working-directory). If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bundle config --local deployment true` is used. +To use a `Gemfile` which is not at the root, set `BUNDLE_GEMFILE` in the `env` at the job level, so it is set for all steps: +```yaml + +jobs: + test: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: subdir/Gemfile + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + - run: bundle exec rake +``` + To perform caching, this action will use `bundle config --local path vendor/bundle`. Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).