Skip to content

Fixes #6149, Fixes part of #6202: Use bazel-contrib/setup-bazel in workflows to setup bazel#6284

Open
ShankhanilSaha wants to merge 2 commits into
oppia:developfrom
ShankhanilSaha:update-actions-running-on-node-20
Open

Fixes #6149, Fixes part of #6202: Use bazel-contrib/setup-bazel in workflows to setup bazel#6284
ShankhanilSaha wants to merge 2 commits into
oppia:developfrom
ShankhanilSaha:update-actions-running-on-node-20

Conversation

@ShankhanilSaha

@ShankhanilSaha ShankhanilSaha commented Jun 20, 2026

Copy link
Copy Markdown
Member

Explanation

Fixes #6149
Fixes part of #6202

  • Replace all workflows using unmaintained abhinavsingh/setup-bazel with bazel's own bazel-contrib/setup-bazel.
  • Enable bazelisk-cache: true to enable caching and preventing bazel being downloaded repeatedly.

Essential Checklist

  • The PR title starts with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The explanation section above starts with "Fixes #bugnum: " (If this PR fixes part of an issue, use instead: "Fixes part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

Summary by CodeRabbit

  • Chores
    • Updated internal build and testing infrastructure tooling to improve build efficiency and caching capabilities.

@ShankhanilSaha ShankhanilSaha requested a review from a team as a code owner June 20, 2026 10:43
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

All 8 GitHub Actions workflow files replace the abhinavsingh/setup-bazel@v3 action (previously pinned to Bazel 6.5.0) with bazel-contrib/setup-bazel@0.19.0 and enable bazelisk-cache: true. The change affects 12 job-level occurrences across build_tests, code_coverage, issue_checks, lesson_checks, static_checks, stats, unit_tests, and wiki workflows.

Changes

Bazel Action Replacement

Layer / File(s) Summary
Bazel setup action swap in all workflows
.github/workflows/build_tests.yml, .github/workflows/code_coverage.yml, .github/workflows/issue_checks.yml, .github/workflows/lesson_checks.yml, .github/workflows/static_checks.yml, .github/workflows/stats.yml, .github/workflows/unit_tests.yml, .github/workflows/wiki.yml
Every job previously using abhinavsingh/setup-bazel@v3 with version: 6.5.0 now uses bazel-contrib/setup-bazel@0.19.0 with bazelisk-cache: true. Affects 12 job-level occurrences across 8 workflow files; no other job logic is changed in any file.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop hop, the old Bazel action's gone,
A new one from the Bazel team's now on!
Twelve jobs updated, all in a row,
The bazelisk cache lets CI flow.
This bunny approves — let the builds grow! 🏗️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly identifies the main change: replacing abhinavsingh/setup-bazel with bazel-contrib/setup-bazel across workflows and addresses the linked issues.
Linked Issues check ✅ Passed The PR successfully implements the primary requirements from issue #6149: migration to official bazel-contrib/setup-bazel action, compatibility with Bazel 6.5.0 (via bazelisk), and application across all workflows.
Out of Scope Changes check ✅ Passed All changes are focused on the stated objective of replacing the Bazel setup action with its official maintained alternative across all workflows, with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ShankhanilSaha

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build_tests.yml:
- Around line 35-37: The action reference in the setup-bazel step uses semantic
versioning (0.19.0) instead of a commit hash, which the static analysis tool
flagged as unpinned. However, since the repository consistently uses semantic
versioning for all GitHub Actions throughout the workflows, this approach is
acceptable for maintainability and consistency. If the decision is made to
enforce stricter action pinning with commit hashes, this change should be
applied consistently across all workflow files in the repository as a
coordinated security hardening effort, not in isolation.

In @.github/workflows/lesson_checks.yml:
- Around line 16-18: The bazel-contrib/setup-bazel@0.19.0 action is executing
before the repository checkout, preventing it from accessing the .bazelversion
file needed to determine the correct Bazel version to install. Move the
actions/checkout step to execute before the setup-bazel action so that the
.bazelversion file is available when the Bazel setup reads it for version
resolution and cache optimization.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 37fd19c0-6d62-4a35-9f4d-72ffd9380a66

📥 Commits

Reviewing files that changed from the base of the PR and between 418dae9 and f69ffbb.

📒 Files selected for processing (8)
  • .github/workflows/build_tests.yml
  • .github/workflows/code_coverage.yml
  • .github/workflows/issue_checks.yml
  • .github/workflows/lesson_checks.yml
  • .github/workflows/static_checks.yml
  • .github/workflows/stats.yml
  • .github/workflows/unit_tests.yml
  • .github/workflows/wiki.yml

Comment on lines +35 to +37
uses: bazel-contrib/setup-bazel@0.19.0
with:
version: 6.5.0
bazelisk-cache: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚖️ Poor tradeoff

Note: Static analysis flagged unpinned action reference.

The static analysis tool flagged this action reference as "unpinned" because it uses a semantic version (@0.19.0) instead of a commit hash. While pinning to commit hashes provides stronger supply-chain security guarantees, this repository consistently uses semantic versioning for all GitHub Actions (e.g., actions/checkout@v6, actions/cache@v5, actions/upload-artifact@v7).

If stricter action pinning is desired, it should be applied consistently across all workflow files as a separate security hardening effort, not just for this specific action.

🧰 Tools
🪛 zizmor (1.25.2)

[error] 35-35: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build_tests.yml around lines 35 - 37, The action reference
in the setup-bazel step uses semantic versioning (0.19.0) instead of a commit
hash, which the static analysis tool flagged as unpinned. However, since the
repository consistently uses semantic versioning for all GitHub Actions
throughout the workflows, this approach is acceptable for maintainability and
consistency. If the decision is made to enforce stricter action pinning with
commit hashes, this change should be applied consistently across all workflow
files in the repository as a coordinated security hardening effort, not in
isolation.

Source: Linters/SAST tools

Comment on lines +16 to +18
uses: bazel-contrib/setup-bazel@0.19.0
with:
version: 6.5.0
bazelisk-cache: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "lesson_checks.yml" -type f

Repository: oppia/oppia-android

Length of output: 101


🏁 Script executed:

cat -n .github/workflows/lesson_checks.yml | head -30

Repository: oppia/oppia-android

Length of output: 1084


🌐 Web query:

bazel-contrib setup-bazel action .bazelversion file behavior

💡 Result:

The bazel-contrib/setup-bazel GitHub Action interacts with the.bazelversion file primarily through its integration with Bazelisk [1][2]. The behavior can be broken down into two main aspects: version resolution and caching [1][3]. Version Selection The primary mechanism for specifying which Bazel version to run in your workspace is the.bazelversion file [4]. When you use bazel-contrib/setup-bazel, it sets up the environment so that Bazelisk is available [5]. Bazelisk itself is designed to automatically detect and read the.bazelversion file located in the workspace root (or parent directories) to determine the correct Bazel version to download and execute [4]. Because the action configures the environment to use Bazelisk, your CI jobs will adhere to the version pinned in this file unless explicitly overridden by other environment variables like USE_BAZEL_VERSION [4]. Caching Behavior The bazel-contrib/setup-bazel action includes a specific feature called bazelisk-cache, which is designed to improve performance by caching Bazelisk downloads [3]. When this feature is enabled (bazelisk-cache: true), the action uses the contents of the.bazelversion file as part of its cache management logic [1][5]. This ensures that the Bazel binary corresponding to the version defined in your.bazelversion file is efficiently cached across CI runs, avoiding unnecessary downloads [3]. Summary of Key Points: - Automatic Detection: By setting up Bazelisk, the action allows Bazelisk's native behavior to take over, which automatically respects the.bazelversion file [4][5]. - Caching Integration: Enabling bazelisk-cache allows the action to tie its cache key directly to the.bazelversion file, optimizing CI speed by caching the specific Bazel binary version required [1][3]. - Migration Note: If you previously used the now-archived bazelbuild/setup-bazelisk action, you can migrate to bazel-contrib/setup-bazel while maintaining the same reliance on.bazelversion for version control [3][6]. You should avoid setting manual bazel-version inputs in the action configuration if you prefer to rely on the.bazelversion file as the single source of truth [1][7].

Citations:


🏁 Script executed:

find . -name ".bazelversion" -type f

Repository: oppia/oppia-android

Length of output: 79


🏁 Script executed:

cat .bazelversion 2>/dev/null || echo "File not found"

Repository: oppia/oppia-android

Length of output: 69


Move the repository checkout before Bazel setup.

In this workflow, the Bazel setup (lines 15-18) executes before the repository checkout (lines 20-23). The bazel-contrib/setup-bazel@0.19.0 action reads the .bazelversion file from the repository root to determine which Bazel version to install and cache. Since checkout hasn't occurred yet, the action cannot access .bazelversion (which specifies version 6.5.0), causing version resolution and cache optimization to fail.

Recommended fix: Move the checkout step before Bazel setup:

Diff
      - name: Set up Bazel
        uses: bazel-contrib/setup-bazel@0.19.0
        with:
          bazelisk-cache: true

      - name: Check out introduce-asset-download-script branch
        uses: actions/checkout@v6
        with:
          ref: introduce-asset-download-script

Becomes:

      - name: Check out introduce-asset-download-script branch
        uses: actions/checkout@v6
        with:
          ref: introduce-asset-download-script

      - name: Set up Bazel
        uses: bazel-contrib/setup-bazel@0.19.0
        with:
          bazelisk-cache: true
🧰 Tools
🪛 zizmor (1.25.2)

[error] 16-16: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/lesson_checks.yml around lines 16 - 18, The
bazel-contrib/setup-bazel@0.19.0 action is executing before the repository
checkout, preventing it from accessing the .bazelversion file needed to
determine the correct Bazel version to install. Move the actions/checkout step
to execute before the setup-bazel action so that the .bazelversion file is
available when the Bazel setup reads it for version resolution and cache
optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Use official setup-bazel workflow

1 participant