Skip to content

Add additional from_string variants #73

Add additional from_string variants

Add additional from_string variants #73

Workflow file for this run

name: Clang Format Check
on:
push:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '*.md'
jobs:
clang-format:
name: Clang Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install clang-format
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y clang-format-19
- name: Fetch base branch
if: github.event_name == 'pull_request'
run: |
echo "Fetching base branch ${{ github.base_ref }}"
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
- name: Get Git Diff
id: diff
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Getting diff for pull request"
git diff origin/${{ github.base_ref }}...HEAD -- '*.c' '*.cpp' '*.hpp' '*.cc' '*.cxx' '*.h' '*.hh' '*.hxx' > diff.patch
else
echo "Getting diff for commit"
git diff ${{ github.event.before }} ${{ github.event.after }} -- '*.c' '*.cpp' '*.hpp' '*.cc' '*.cxx' '*.h' '*.hh' '*.hxx' > diff.patch
fi
- name: Check formatting
shell: bash
run: |
cat diff.patch | clang-format-diff-19 -p 1 > diff_format.patch
if [ -s diff_format.patch ]; then
echo "❌ Code formatting issues found. See diff_format.patch."
exit 1
fi
- name: Upload clang-formatted diff
if: failure()
uses: actions/upload-artifact@v4
with:
name: clang-format-diff
path: diff_format.patch