Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions check-code-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ name: "Check Code Style"
desciption: "Check files for correct code style"

inputs:
os:
description: "Specify operating system on which this action will run"
buildifier-version:
description: "Version of 'buildifier' to install"
required: false
default: '5.1.0'

runs:
using: "composite"
steps:
- name: Install clang-format-13 if Ubuntu
if: inputs.os == 'ubuntu-latest'
if: ${{ runner.os == 'Linux' }}
run: |
# Install Clang 13 (including clang-format-13) through LLVM's preferred mechanism:
# https://apt.llvm.org/
Expand All @@ -29,8 +31,11 @@ runs:

# On macOS we should install clang-format.
- name: Install clang-format-13 if macOS
if: inputs.os == 'macos-latest'
if: ${{ runner.os == 'macOS' }}
run: |
# TODO(benh): is 'brew' not in PATH on macOS like it is not in
# the PATH for Linux? If so, where does GitHub install 'brew'
# on a macOS runner?
brew install clang-format@13
shell: bash

Expand All @@ -40,8 +45,14 @@ runs:
${{ github.action_path }}/check_style_of_all_files.sh
shell: bash

- name: Install buildifier for .bzl files
run: brew install buildifier
- name: Install buildifier for .bzl files (macOS)
if: ${{ runner.os == 'macOS' }}
run: brew install buildifier@${{ inputs.buildifier-version }}
shell: bash

- name: Install buildifier for .bzl files (Linux)
if: ${{ runner.os == 'Linux' }}
run: /home/linuxbrew/.linuxbrew/bin/brew install buildifier@${{ inputs.buildifier-version }}
shell: bash

- name: Check all .bzl, .bazel files for correct code style
Expand Down