ci: add daily buildifier formatting cron that opens a PR on changes#375
Merged
Merged
Conversation
Adds a //cli/format:buildifier format_multirun target (backed by a new buildifier_prebuilt dev dependency) and a daily cron that runs it over all Starlark/BUILD files, opening a PR only when buildifier produced changes. Mirrors the ktfmt format cron: force-pushes a dedicated bot-owned branch (ci/buildifier-format) so re-runs reuse one PR, and never touches master. A .gitattributes marks cli/src/test/resources/** as rules-lint-ignored so neither formatter rewrites the deliberately-constructed E2E test fixtures (e.g. module_bazel_comment's comment-preservation scenario). Both format crons now run pinned to .bazelversion with --lockfile_mode=off so MODULE.bazel.lock is never relocked mid-run, keeping the generated PRs limited to formatting-only changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a second daily formatting cron — this one runs buildifier over all Starlark/BUILD files and opens a PR only when it produced changes. Complements the ktfmt cron added in #373.
How
//cli/format:buildifier— aformat_multirunconfigured withstarlark = "@buildifier_prebuilt//:buildifier", backed by a newbuildifier_prebuiltdev dependency. Kept separate from the kotlin//cli/formattarget so the two crons never reformat each other's files..github/workflows/buildifier.yaml— daily at 12:30 UTC (between the ktfmt and coverage-badge crons), plus aworkflow_dispatchbutton. Reuses the established rolling-PR pattern: force-pushes a bot-ownedci/buildifier-formatbranch and reuses the open PR if one exists. Never touches master directly..gitattributesmarkingcli/src/test/resources/**asrules-lint-ignored. Those workspaces are deliberately-constructed E2E inputs (e.g.module_bazel_commentexercises comment preservation,cquery_failing_targetencodes a failure scenario) — formatting them would corrupt the very thing under test. No Kotlin lives there, so this only affects buildifier..bazelversion(dropped the explicitUSE_BAZEL_VERSION: 9.x) and pass--lockfile_mode=off, soMODULE.bazel.lockis never rewritten mid-run. This keeps the generated formatting PRs limited to formatting-only changes.Notes
MODULE.bazel.lockchurn here is the legitimate result of promotingbuildifier_prebuiltto a direct dep (8.5.1.2); the old 6.4.0 download-extension specs are no longer used.cli/BUILD,proto/BUILD, andtools/BUILD(already flagged bybuildifier.check) and open a PR for them — intentionally left out of this infra PR to keep the diff focused.scheduletriggers only activate once this lands onmaster.Verified locally:
bazel run //cli/format:buildifier.check --lockfile_mode=offflags exactly the 3 real BUILD files, skips all fixtures, and leavesMODULE.bazel.lockuntouched.🤖 Generated with Claude Code