Add Buildifier Github Action#139
Draft
danielibarrola wants to merge 1 commit intogoogle-ml-infra:mainfrom
Draft
Conversation
2efe416 to
801064b
Compare
97ab39f to
7d317a6
Compare
7d317a6 to
ed5d863
Compare
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.
This pull request introduces a new GitHub Action and supporting infrastructure to automate Bazel formatting checks using
buildifier. It ensures that all Starlark files (BUILD,WORKSPACE,MODULE.bazel,.bzl) adhere to standard formatting guidelines.Changes
1. Buildifier Composite Action (
ci_buildifier/)ci_buildifier/action.yamlthat:git diff.buildifier --mode=checkon identified files.filepathsinput for manual overrides.README.mdin the action directory with usage instructions and prerequisites.2. GitHub Workflows
.github/workflows/buildifier-check.yml): A standard workflow that runs the check on themainbranch and pull requests..github/workflows/buildifier-check-on-error.yml): A specialized test workflow designed to verify that the action correctly fails when it encounters unformatted code.3. Test Suite (
tests/ci_buildifier/)formatted/: Contains a correctly formattedBUILDfile.unformatted/: Contains intentionally misformattedBUILD,WORKSPACE,MODULE.bazel, and.bzlfiles to test the "check" mode's failure detection.How to use
You can integrate this check into your workflows by adding the following step:
Verification Results
buildifier-checkworkflow successfully passes when pointing at theformatted/directory.buildifier-check-on-errorworkflow successfully catches errors in theunformatted/directory and confirms the expected failure outcome.