Skip to content

Use CONFIG to find protobuf #236

Use CONFIG to find protobuf

Use CONFIG to find protobuf #236

Workflow file for this run

name: Clang format
on: [pull_request]
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install prerequisites
run: |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 100
sudo update-alternatives --install /usr/bin/git-clang-format git-clang-format /usr/bin/git-clang-format-11 100
- name: Run clang-format on changed files
run: |
set -x
git fetch origin ${{ github.event.pull_request.base.ref }}
base_commit=$(git rev-parse ${{ github.event.pull_request.base.sha }})
result_output=$(git diff --diff-filter d --name-only "$base_commit" |
xargs -d '\n' git-clang-format --commit "$base_commit" --diff --style file)
if [ "$result_output" = 'no modified files to format' ] ||
[ "$result_output" = 'clang-format did not modify any files' ]
then
exit 0
else
git-clang-format --commit "$base_commit" --diff --style file
echo "$result_output"
exit 1
fi