Skip to content

Commit c782da2

Browse files
authored
Document how to replace bundle config commands
1 parent 5aaa89f commit c782da2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,22 @@ If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bund
162162
To use a `Gemfile` which is not at the root or has a different name, set `BUNDLE_GEMFILE` in the `env` at the job level
163163
as shown in the [example](#matrix-of-gemfiles).
164164

165-
When 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.
166-
In other words, it works exactly like `bundle install`.
167-
The hash of the generated lockfile is then used for caching, which is the only correct approach.
165+
#### bundle config
166+
167+
When using `bundler-cache: true` you might notice there is no good place to run `bundle config ...` commands.
168+
These can be replaced by `BUNDLE_*` environment variables, which are also faster.
169+
They should be set the `env` at the job level as shown in the [example](#matrix-of-gemfiles).
170+
See the [Bundler docs](https://bundler.io/man/bundle-config.1.html) or look at `.bundle/config` locally for the environment variable names,
168171

169172
To perform caching, this action will use `bundle config --local path $PWD/vendor/bundle`.
170173
Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).
171174

175+
#### How it Works
176+
177+
When 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.
178+
In other words, it works exactly like `bundle install`.
179+
The hash of the generated lockfile is then used for caching, which is the only correct approach.
180+
172181
#### Caching `bundle install` manually
173182

174183
It is also possible to cache gems manually, but this is not recommended because it is verbose and *very difficult* to do correctly.

0 commit comments

Comments
 (0)