Skip to content

GitHub action for running Bazel's format tool buildifier.

License

Notifications You must be signed in to change notification settings

jbajic/buildifier

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buildifier action

verify-run-buildifier.yml

GitHub Action for running Bazel's build tool buildifier. Works on linux, macOS and windows.

Buildifier automatically checks one of the Bazel's files:

  • BUILD
  • WORKSPACE
  • .bzl

Inputs

Name Description Required Default
version The version of the used buildifier false 6.0.0
path The path on which to run buildifier check. false .
mode The mode in which to run buildifier [check|diff] false check

Example Usage

To use buildifier action you can follow presented examples to see how it works:

Check every file

name: Bazel files check
on: [push]
jobs:
  formatting-check:
    name: Run buildifier check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - name: Run buildifier
      uses: jbajic/buildifier@v1

Check files in src directory

name: Check bazel files
on: [push]
jobs:
  formatting-check:
    name: Run buildifier check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - name: Run buildifier
      uses: jbajic/buildifier@v1
      with:
        path: src

Check all Bazel files and print out the difference

name: Check bazel files
on: [push]
jobs:
  formatting-check:
    name: Run buildifier check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - name: Run buildifier
      uses: jbajic/buildifier@v1
      with:
        path: src
        mode: diff

To print out the diff two steps will be performed:

  1. Run buildifier in multi_diff mode,
  2. Run git diff and print out the changes.

License

Apache-2.0