Skip to content

Commit 4d7e038

Browse files
authored
Show how to set BUNDLE_GEMFILE in the README
1 parent e27aee1 commit 4d7e038

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ This caching speeds up installing gems significantly and avoids too many request
136136
It needs a `Gemfile` (or `$BUNDLE_GEMFILE` or `gems.rb`) under the [`working-directory`](#working-directory).
137137
If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bundle config --local deployment true` is used.
138138

139+
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:
140+
```yaml
141+
142+
jobs:
143+
test:
144+
runs-on: ubuntu-latest
145+
env:
146+
BUNDLE_GEMFILE: subdir/Gemfile
147+
steps:
148+
- uses: actions/checkout@v2
149+
- uses: ruby/setup-ruby@v1
150+
with:
151+
ruby-version: 2.6
152+
bundler-cache: true
153+
- run: bundle exec rake
154+
```
155+
139156
To perform caching, this action will use `bundle config --local path vendor/bundle`.
140157
Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).
141158

0 commit comments

Comments
 (0)