Skip to content

Fetch branches before diff #41

Fetch branches before diff

Fetch branches before diff #41

name: Check Clang-Format on Diff
on: [push, pull_request]
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Import LLVM GPG Key
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
- name: Add LLVM Repository
run: |
sudo add-apt-repository "deb http://apt.llvm.org/jammy llvm-toolchain-jammy-17 main"
sudo apt-get update
- name: Install clang-format 17
run: |
sudo apt-get install clang-format-17
- name: Fetch branches to check
run: |
git fetch origin ${{ github.base_ref }}
git fetch origin ${{ github.head_ref }}
- name: Check Clang-Format on Diff
run: |
./clang-format-diff.sh ${{ github.base_ref }} ${{ github.head_ref }}
- name: Apply Clang-Format locally
if: github.event_name == 'pull_request'
run: |
./clang-format-apply.sh ${{ github.base_ref }} ${{ github.head_ref }}
- name: Suggest changes
uses: parkerbxyz/suggest-changes@v1
if: github.event_name == 'pull_request'
with:
comment: 'Please make the changes suggested by clang-format'