name: Guidelines
on:
  pull_request:
    types: [opened, synchronize]
  workflow_dispatch:
  push:
    branches:
      - 'master'

jobs:
  Code-Style:
    runs-on: ubuntu-latest

    steps:
    - name: checkout
      uses: actions/checkout@v4
      with:
        fetch-depth: 2

    - name: clang-format
      id: clang-format
      run: sh/run_test_format.sh

    - name: format patch
      if: ${{ failure() }}
      run: git diff > reformat.patch

    - name: upload-full-clang-format-config
      if: ${{ failure() }}
      uses: actions/upload-artifact@v4
      with:
        name: reformat.patch
        path: reformat.patch

