name: Update generated headers
on:
  push:
    branches-ignore:
      - 'dependabot/**'
jobs:
  generate-headers:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - name: Setup
      run: |
        sudo rm /etc/apt/sources.list.d/microsoft-prod.list
        sudo apt update
        sudo apt install -y libboost-dev
    - name: Configure
      run: |
        ./autogen.sh
        ./configure
    - name: Update headers
      run: |
        find ql -name *.am | xargs touch
        make dist
        rm QuantLib-*.tar.gz
    - uses: peter-evans/create-pull-request@v8
      with:
        token: ${{ secrets.MACHINE_ACCOUNT_PAT }}
        push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib
        branch: update-generated-headers-${{ github.ref_name }}
        delete-branch: true
        commit-message: 'Update generated headers'
        title: 'Update generated headers'
        author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com>
