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`).