name: Apply clang-tidy fixes
on:
  schedule:
    - cron: '0 0 * * 0'
  workflow_dispatch:
jobs:
  check:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v6
    - name: Setup
      run: |
        sudo apt-get update
        sudo apt-get install -y clang-tidy-19 libboost-dev
    - name: Check
      run: |
        cmake --preset linux-ci-build-with-clang-tidy
        cd build/linux-ci-build-with-clang-tidy
        cmake --build . -j1
    - uses: peter-evans/create-pull-request@v8
      if: ${{ always() }}
      with:
        token: ${{ secrets.MACHINE_ACCOUNT_PAT }}
        push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib
        branch: clang-tidy-fixes-${{ github.ref_name }}
        delete-branch: true
        commit-message: 'Automated fixes by clang-tidy'
        title: 'Automated fixes by clang-tidy'
        author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com>
        body: |
          This is an automated PR generated by the [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action.

          Please review the changes before merging.

