Skip to content

Gh action clang pr2

Gh action clang pr2 #6

Workflow file for this run

name: "check clang format"
# run on pull requests to develop
on:
pull_request
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
# fetch everything to be able to compare with any ref
fetch-depth: 0
- name: check
env:
LANG: "C.UTF-8"
LC_ALL: "C.UTF-8"
LANGUAGE: "C.UTF-8"
run: |
sudo apt install -y clang-format-15 python3 git
diff_output_file=$(mktemp)
git --no-pager diff --diff-filter=ACMRT ${{github.event.pull_request.base.sha}} ${{ github.event.pull_request.head.sha }}| clang-format-diff-15 -p1 2>&1 | tee $diff_output_file
if [ -s $diff_output_file ]; then
exit 1
else
exit 0
fi