Skip to content

ci: enforce buildifier format + lint on every PR#11

Merged
benfdking merged 1 commit into
mainfrom
ci/buildifier-check
May 23, 2026
Merged

ci: enforce buildifier format + lint on every PR#11
benfdking merged 1 commit into
mainfrom
ci/buildifier-check

Conversation

@benfdking
Copy link
Copy Markdown

Summary

Enables a Buildifier CI check that runs on every PR and main push, gating both format (mode=diff) and lint (lint=warn) findings on all Starlark files.

The wiring already existed in .github/workflows/BUILD.bazel and .github/workflows/buildifier.yaml.disabled — this PR brings the tree to a clean state and turns the workflow on.

Why the dep bump

buildifier_prebuilt 6.1.2's generated wrapper looks for the binary at external/<repo>/file/buildifier, but Bazel 9's bzlmod runfiles put it at the runfiles root. The result: bazelisk run //.github/workflows:buildifier.check silently exits 1 with no output (xargs invokes an empty path). Bumping to 8.5.1.2 fixes the wrapper.

Lint findings fixed

  • playwright/repositories.bzl:28,87_playwright_repo_impl and _define_browsers_impl had implicit returns after a conditional return ctx.repo_metadata(...). Added explicit return None.
  • playwright/private/known_browsers.bzl:1 — file had no module docstring. Added one.
  • playwright/private/integrity_map.bzl:122print() is buildifier-flagged, but it's the deliberate deprecation warning for the legacy playright_repo_name attr. Added # buildifier: disable=print so the warning behavior is preserved without the lint failure.
  • playwright/private/browser_targets.bzl:66,113compute_browser_targets and render_workspace_files had one-liner docstrings missing Args: and Returns: sections. Expanded.

Format fixes

Buildifier auto-applied minor blank-line tweaks to browser_targets.bzl and integrity_map.bzl.

Workflow tweaks

  • Renamed .github/workflows/buildifier.yaml.disabledbuildifier.yml
  • Switched bazelbazelisk for consistency with tests.yml (and to honor .bazelversion)
  • Dropped the redundant --enable_bzlmod flag (default in Bazel 9)
  • Dropped the branches: [main] filter on pull_request to match tests.yml behavior

Noted but NOT fixed in this PR

playwright/private/browser_targets.bzl:25-28 has a duplicate debian13 condition that looks like a typo from the debian13 platform-support commit — buildifier doesn't flag duplicate branches, but it's worth fixing separately.

Test plan

  • The new Buildifier job is green on this PR
  • Existing Build and Test job remains green
  • Locally: bazelisk run //.github/workflows:buildifier.check exits 0

🤖 Generated with Claude Code

Enables a Buildifier workflow that runs //.github/workflows:buildifier.check
on every PR and main push. The check runs in diff+warn mode, so the gate
fires on both formatting drift and lint findings.

Changes required to bring the tree to a clean state:

- MODULE.bazel: bump buildifier_prebuilt 6.1.2 -> 8.5.1.2. The 6.1.2
  wrapper hardcodes `external/<repo>/file/buildifier` for its runfiles
  lookup, but Bazel 9's bzlmod runfiles put the binary at the runfiles
  root, so `bazel run` silently failed with no output.

- playwright/repositories.bzl: add explicit `return None` at the end of
  _playwright_repo_impl and _define_browsers_impl so all execution paths
  return a value (fixes return-value lint).

- playwright/private/known_browsers.bzl: add module docstring.

- playwright/private/integrity_map.bzl: silence the print() lint on
  the deprecation warning we deliberately emit for the misspelled
  `playright_repo_name` attr.

- playwright/private/browser_targets.bzl: flesh out docstrings on
  compute_browser_targets and render_workspace_files with Args/Returns
  sections, plus buildifier's auto-format pass.

- tools/config_setting/BUILD.bazel: drop a stray blank line.

- .github/workflows/buildifier.yaml.disabled -> buildifier.yml: rename
  to enable the workflow, switch `bazel` -> `bazelisk` for consistency
  with tests.yml, and drop the now-default --enable_bzlmod flag.

Note: playwright/private/browser_targets.bzl:25-28 has a duplicate
`debian13` condition that looks like a typo introduced by the debian13
support commit. Worth a separate fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@benfdking benfdking merged commit 8b8c28b into main May 23, 2026
2 checks passed
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.

1 participant