Use BUNDLE_LOCKFILE when detecting the lockfile#919
Conversation
Honor `BUNDLE_LOCKFILE` (added in Bundler 4) when selecting the lockfile used for Bundler version detection, deployment mode, and bundler-cache keys. Without this, workflows using an alternate lockfile can read the wrong `BUNDLED WITH` version and generate cache keys from the wrong lockfile.
ae3fce3 to
a34034a
Compare
|
|
||
| if (fs.existsSync(gemfilePath)) { | ||
| return [gemfilePath, `${gemfilePath}.lock`] | ||
| return [gemfilePath, lockfilePath || `${gemfilePath}.lock`] |
There was a problem hiding this comment.
Given that we have a fs.existsSync check for BUNDLE_GEMFILE or its default value Gemfile that would thrown an exception if missing, we should probably have fs.existsSync check for BUNDLE_LOCKFILE if it's explicitly set. In this case, unlike the check for gemfilePath, we should not check existence of Gemfile.lock because it's optional.
There was a problem hiding this comment.
I'm not following, the code is fine as-is, no? Because the lockfile is always optional.
There was a problem hiding this comment.
If you explicit define an environment variable for it, most likely it means you want to explicitly use that file. In that case if the file specified in the variable does not exist and we treat it as optional, wouldn’t that be confusing?
There was a problem hiding this comment.
Since it's a variable recognized by Bundler people might use it independently of setup-ruby so I think it's fine and not something we should check.
But, that makes me think probably this needs to be part of the cache key.
There was a problem hiding this comment.
lockFile is already in computeBaseKey, so all good
Bumps the github-actions group with 3 updates: [github/codeql-action](https://github.com/github/codeql-action), [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) and [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `github/codeql-action` from 4.36.1 to 4.36.2 Release notes *Sourced from [github/codeql-action's releases](https://github.com/github/codeql-action/releases).* > v4.36.2 > ------- > > * Cache CodeQL CLI version information across Actions steps. [#3943](https://redirect.github.com/github/codeql-action/pull/3943) > * Reduce requests while waiting for analysis processing by using exponential backoff when polling SARIF processing status. [#3937](https://redirect.github.com/github/codeql-action/pull/3937) > * Update default CodeQL bundle version to [2.25.6](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.6). [#3948](https://redirect.github.com/github/codeql-action/pull/3948) Changelog *Sourced from [github/codeql-action's changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md).* > CodeQL Action Changelog > ======================= > > See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs. > > [UNRELEASED] > ------------ > > No user facing changes. > > 4.36.2 - 04 Jun 2026 > -------------------- > > * Cache CodeQL CLI version information across Actions steps. [#3943](https://redirect.github.com/github/codeql-action/pull/3943) > * Reduce requests while waiting for analysis processing by using exponential backoff when polling SARIF processing status. [#3937](https://redirect.github.com/github/codeql-action/pull/3937) > * Update default CodeQL bundle version to [2.25.6](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.6). [#3948](https://redirect.github.com/github/codeql-action/pull/3948) > > 4.36.1 - 02 Jun 2026 > -------------------- > > No user facing changes. > > 4.36.0 - 22 May 2026 > -------------------- > > * *Breaking change*: Bump the minimum required CodeQL bundle version to 2.19.4. [#3894](https://redirect.github.com/github/codeql-action/pull/3894) > * Add support for SHA-256 Git object IDs. [#3893](https://redirect.github.com/github/codeql-action/pull/3893) > * Update default CodeQL bundle version to [2.25.5](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.5). [#3926](https://redirect.github.com/github/codeql-action/pull/3926) > > 4.35.5 - 15 May 2026 > -------------------- > > * We have improved how the JavaScript bundles for the CodeQL Action are generated to avoid duplication across bundles and reduce the size of the repository by around 70%. This should have no effect on the runtime behaviour of the CodeQL Action. [#3899](https://redirect.github.com/github/codeql-action/pull/3899) > * For performance and accuracy reasons, [improved incremental analysis](https://redirect.github.com/github/roadmap/issues/1158) will now only be enabled on a pull request when diff-informed analysis is also enabled for that run. If diff-informed analysis is unavailable (for example, because the PR diff ranges could not be computed), the action will fall back to a full analysis. [#3791](https://redirect.github.com/github/codeql-action/pull/3791) > * If multiple inputs are provided for the GitHub-internal `analysis-kinds` input, only `code-scanning` will be enabled. The `analysis-kinds` input is experimental, for GitHub-internal use only, and may change without notice at any time. [#3892](https://redirect.github.com/github/codeql-action/pull/3892) > * Added an experimental change which, when running a Code Scanning analysis for a PR with [improved incremental analysis](https://redirect.github.com/github/roadmap/issues/1158) enabled, prefers CodeQL CLI versions that have a cached overlay-base database for the configured languages. This speeds up analysis for a repository when there is not yet a cached overlay-base database for the latest CLI version. We expect to roll this change out to everyone in May. [#3880](https://redirect.github.com/github/codeql-action/pull/3880) > > 4.35.4 - 07 May 2026 > -------------------- > > * Update default CodeQL bundle version to [2.25.4](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.4). [#3881](https://redirect.github.com/github/codeql-action/pull/3881) > > 4.35.3 - 01 May 2026 > -------------------- > > * *Upcoming breaking change*: Add a deprecation warning for customers using CodeQL version 2.19.3 and earlier. These versions of CodeQL were discontinued on 9 April 2026 alongside GitHub Enterprise Server 3.15, and will be unsupported by the next minor release of the CodeQL Action. [#3837](https://redirect.github.com/github/codeql-action/pull/3837) > * Configurations for private registries that use Cloudsmith or GCP OIDC are now accepted. [#3850](https://redirect.github.com/github/codeql-action/pull/3850) > * Best-effort connection tests for private registries now use `GET` requests instead of `HEAD` for better compatibility with various registry implementations. For NuGet feeds, the test is now always performed against the service index. [#3853](https://redirect.github.com/github/codeql-action/pull/3853) > * Fixed a bug where two diagnostics produced within the same millisecond could overwrite each other on disk, causing one of them to be lost. [#3852](https://redirect.github.com/github/codeql-action/pull/3852) > * Update default CodeQL bundle version to [2.25.3](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.3). [#3865](https://redirect.github.com/github/codeql-action/pull/3865) > > 4.35.2 - 15 Apr 2026 > -------------------- > > * The undocumented TRAP cache cleanup feature that could be enabled using the `CODEQL_ACTION_CLEANUP_TRAP_CACHES` environment variable is deprecated and will be removed in May 2026. If you are affected by this, we recommend disabling TRAP caching by passing the `trap-caching: false` input to the `init` Action. [#3795](https://redirect.github.com/github/codeql-action/pull/3795) > * The Git version 2.36.0 requirement for improved incremental analysis now only applies to repositories that contain submodules. [#3789](https://redirect.github.com/github/codeql-action/pull/3789) > * Python analysis on GHES no longer extracts the standard library, relying instead on models of the standard library. This should result in significantly faster extraction and analysis times, while the effect on alerts should be minimal. [#3794](https://redirect.github.com/github/codeql-action/pull/3794) > * Fixed a bug in the validation of OIDC configurations for private registries that was added in CodeQL Action 4.33.0 / 3.33.0. [#3807](https://redirect.github.com/github/codeql-action/pull/3807) > * Update default CodeQL bundle version to [2.25.2](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.2). [#3823](https://redirect.github.com/github/codeql-action/pull/3823) ... (truncated) Commits * [`8aad20d`](github/codeql-action@8aad20d) Merge pull request [#3949](https://redirect.github.com/github/codeql-action/issues/3949) from github/update-v4.36.2-dcb947ce1 * [`f521b08`](github/codeql-action@f521b08) Add additional changelog notes * [`8aeff0f`](github/codeql-action@8aeff0f) Update changelog for v4.36.2 * [`dcb947c`](github/codeql-action@dcb947c) Merge pull request [#3948](https://redirect.github.com/github/codeql-action/issues/3948) from github/update-bundle/codeql-bundle-v2.25.6 * [`c251bce`](github/codeql-action@c251bce) Add changelog note * [`62953c1`](github/codeql-action@62953c1) Update default bundle to codeql-bundle-v2.25.6 * [`423b570`](github/codeql-action@423b570) Merge pull request [#3946](https://redirect.github.com/github/codeql-action/issues/3946) from github/dependabot/npm\_and\_yarn/npm-minor-5d507a... * [`c35d1b1`](github/codeql-action@c35d1b1) Merge pull request [#3947](https://redirect.github.com/github/codeql-action/issues/3947) from github/dependabot/github\_actions/dot-github/wor... * [`cb1a588`](github/codeql-action@cb1a588) Merge pull request [#3937](https://redirect.github.com/github/codeql-action/issues/3937) from github/robertbrignull/waitForProcessing\_backoff * [`ba47406`](github/codeql-action@ba47406) Merge pull request [#3943](https://redirect.github.com/github/codeql-action/issues/3943) from github/henrymercer/cache-cli-version-info * Additional commits viewable in [compare view](github/codeql-action@87557b9...8aad20d) Updates `anthropics/claude-code-action` from 1.0.135 to 1.0.144 Release notes *Sourced from [anthropics/claude-code-action's releases](https://github.com/anthropics/claude-code-action/releases).* > v1.0.144 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.144> > > v1.0.143 > -------- > > What's Changed > -------------- > > * Drop --tsconfig-override from Bun invocations to avoid runtime crash by [`@chsmc-ant`](https://github.com/chsmc-ant) in [anthropics/claude-code-action#1315](https://redirect.github.com/anthropics/claude-code-action/pull/1315) > > New Contributors > ---------------- > > * [`@chsmc-ant`](https://github.com/chsmc-ant) made their first contribution in [anthropics/claude-code-action#1315](https://redirect.github.com/anthropics/claude-code-action/pull/1315) > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.143> > > v1.0.142 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.142> > > v1.0.141 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.141> > > v1.0.140 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.140> > > v1.0.139 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.139> > > v1.0.138 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.138> > > v1.0.137 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.137> > > v1.0.136 > -------- > > **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.136> Commits * [`0f97b95`](anthropics/claude-code-action@0f97b95) chore: bump Claude Code to 2.1.173 and Agent SDK to 0.3.173 * [`eee73e2`](anthropics/claude-code-action@eee73e2) chore: bump Claude Code to 2.1.172 and Agent SDK to 0.3.172 * [`232c9a1`](anthropics/claude-code-action@232c9a1) Drop --tsconfig-override from Bun invocations to avoid runtime crash ([#1315](https://redirect.github.com/anthropics/claude-code-action/issues/1315)) * [`11ba604`](anthropics/claude-code-action@11ba604) chore: bump Claude Code to 2.1.170 and Agent SDK to 0.3.170 * [`593d7a5`](anthropics/claude-code-action@593d7a5) chore: bump Claude Code to 2.1.169 and Agent SDK to 0.3.169 * [`fbda2eb`](anthropics/claude-code-action@fbda2eb) chore: bump Claude Code to 2.1.168 and Agent SDK to 0.3.168 * [`64de744`](anthropics/claude-code-action@64de744) chore: bump Claude Code to 2.1.167 and Agent SDK to 0.3.167 * [`4101658`](anthropics/claude-code-action@4101658) chore: bump Claude Code to 2.1.166 and Agent SDK to 0.3.166 * [`41ea764`](anthropics/claude-code-action@41ea764) chore: bump Claude Code to 2.1.165 and Agent SDK to 0.3.165 * [`0b1b620`](anthropics/claude-code-action@0b1b620) chore: bump Claude Code to 2.1.163 and Agent SDK to 0.3.163 * See full diff in [compare view](anthropics/claude-code-action@70a6e52...0f97b95) Updates `ruby/setup-ruby` from 1.310.0 to 1.312.0 Release notes *Sourced from [ruby/setup-ruby's releases](https://github.com/ruby/setup-ruby/releases).* > v1.312.0 > -------- > > What's Changed > -------------- > > * Use BUNDLE\_LOCKFILE when detecting the lockfile by [`@Thomascountz`](https://github.com/Thomascountz) in [ruby/setup-ruby#919](https://redirect.github.com/ruby/setup-ruby/pull/919) > > New Contributors > ---------------- > > * [`@Thomascountz`](https://github.com/Thomascountz) made their first contribution in [ruby/setup-ruby#919](https://redirect.github.com/ruby/setup-ruby/pull/919) > > **Full Changelog**: <ruby/setup-ruby@v1.311.0...v1.312.0> > > v1.311.0 > -------- > > What's Changed > -------------- > > * Add jruby-9.4.15.0 by [`@ruby-builder-bot`](https://github.com/ruby-builder-bot) in [ruby/setup-ruby#920](https://redirect.github.com/ruby/setup-ruby/pull/920) > > **Full Changelog**: <ruby/setup-ruby@v1.310.0...v1.311.0> Commits * [`12fd324`](ruby/setup-ruby@12fd324) Use BUNDLE\_LOCKFILE when detecting the lockfile * [`a99ac84`](ruby/setup-ruby@a99ac84) Add jruby-9.4.15.0 * See full diff in [compare view](ruby/setup-ruby@afeafc3...12fd324) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
If a workflow sets
BUNDLE_LOCKFILE, setup-ruby still assumes${BUNDLE_GEMFILE}.lockorgems.locked. That means it can read the wrongBUNDLED WITHversion, fail to enable deployment mode because it checks the wrong lockfile path, and/or generate a cache key from the wrong lockfile.Bundler added
BUNDLE_LOCKFILEsupport in PR #9059