From 1488d6ff606cddf96010dc1c160720424d61dee6 Mon Sep 17 00:00:00 2001 From: Benjamin Hindman Date: Fri, 23 Sep 2022 21:20:41 +0000 Subject: [PATCH 1/3] Use full path to 'brew' since GitHub recently removed it from PATH --- check-code-style/action.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/check-code-style/action.yml b/check-code-style/action.yml index b42c032..d4cf421 100644 --- a/check-code-style/action.yml +++ b/check-code-style/action.yml @@ -31,6 +31,9 @@ runs: - name: Install clang-format-13 if macOS if: inputs.os == 'macos-latest' 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 @@ -40,10 +43,16 @@ runs: ${{ github.action_path }}/check_style_of_all_files.sh shell: bash - - name: Install buildifier for .bzl files + - name: Install buildifier for .bzl files (macos) + if: inputs.os == 'macos-latest' run: brew install buildifier shell: bash + - name: Install buildifier for .bzl files (ubuntu) + if: inputs.os == 'ubuntu-latest' + run: /home/linuxbrew/.linuxbrew/bin/brew install buildifier + shell: bash + - name: Check all .bzl, .bazel files for correct code style run: | chmod +x ${{ github.action_path }}/check_style_bzl.sh From 7fd360e8ec02adb645710696308f8a41889abebb Mon Sep 17 00:00:00 2001 From: Benjamin Hindman Date: Fri, 23 Sep 2022 22:24:43 +0000 Subject: [PATCH 2/3] Allow installing specific version of 'buildifier' --- check-code-style/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/check-code-style/action.yml b/check-code-style/action.yml index d4cf421..c3d60b3 100644 --- a/check-code-style/action.yml +++ b/check-code-style/action.yml @@ -5,6 +5,10 @@ name: "Check Code Style" desciption: "Check files for correct code style" inputs: + buildifier-version: + description: "Version of 'buildifier' to install" + required: false + default: '5.1.0' os: description: "Specify operating system on which this action will run" @@ -45,12 +49,12 @@ runs: - name: Install buildifier for .bzl files (macos) if: inputs.os == 'macos-latest' - run: brew install buildifier + run: brew install buildifier@${{ inputs.buildifier-version }} shell: bash - name: Install buildifier for .bzl files (ubuntu) if: inputs.os == 'ubuntu-latest' - run: /home/linuxbrew/.linuxbrew/bin/brew install buildifier + run: /home/linuxbrew/.linuxbrew/bin/brew install buildifier@${{ inputs.buildifier-version }} shell: bash - name: Check all .bzl, .bazel files for correct code style From 6111f24469460ad4267cb4c6845d22e228a58f9f Mon Sep 17 00:00:00 2001 From: Benjamin Hindman Date: Fri, 23 Sep 2022 22:28:09 +0000 Subject: [PATCH 3/3] Use 'runner.os' instead of an 'os' input --- check-code-style/action.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/check-code-style/action.yml b/check-code-style/action.yml index c3d60b3..8769df7 100644 --- a/check-code-style/action.yml +++ b/check-code-style/action.yml @@ -9,14 +9,12 @@ inputs: description: "Version of 'buildifier' to install" required: false default: '5.1.0' - os: - description: "Specify operating system on which this action will run" 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/ @@ -33,7 +31,7 @@ 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' @@ -47,13 +45,13 @@ runs: ${{ github.action_path }}/check_style_of_all_files.sh shell: bash - - name: Install buildifier for .bzl files (macos) - if: inputs.os == 'macos-latest' + - 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 (ubuntu) - if: inputs.os == 'ubuntu-latest' + - name: Install buildifier for .bzl files (Linux) + if: ${{ runner.os == 'Linux' }} run: /home/linuxbrew/.linuxbrew/bin/brew install buildifier@${{ inputs.buildifier-version }} shell: bash