Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ They should be set in the `env` at the job level as shown in the [example](#matr
To 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.
You might need to `"`-quote the environment variable name in YAML if it has unusual characters like `/`.

By default, `bundle install` is run with `--jobs` set to the number of available processors (up to 8).
This can be changed by setting `BUNDLE_JOBS`.

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

Expand Down
11 changes: 8 additions & 3 deletions bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,15 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
console.log(`Found cache for key: ${cachedKey}`)
}

// Number of jobs should scale with runner, up to a point
const jobs = Math.min(os.availableParallelism(), 8)
const installArgs = ['install']
// Honor $BUNDLE_JOBS if set, as passing --jobs would override it
if (!process.env['BUNDLE_JOBS']) {
// Number of jobs should scale with runner, up to a point
const jobs = Math.min(os.availableParallelism(), 8)
installArgs.push('--jobs', `${jobs}`)
}
// Always run 'bundle install' to list the gems
await exec.exec('bundle', ['install', '--jobs', `${jobs}`])
await exec.exec('bundle', installArgs)

// @actions/cache only allows to save for non-existing keys
// Also, skip saving cache for merge_group event
Expand Down
11 changes: 8 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.