name: Build Typst document
on: [push, pull_request]
jobs:
  typst-build:
    runs-on: ubuntu-latest
    if: ${{ github.ref == 'refs/heads/main' }}
    steps:
      - uses: actions/checkout@v3
      - name: Build Typst
        uses: lvignoli/typst-action@main
        with:
          source_file: |
            typst/main.typ
      - name: Push changes
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          file_pattern: "typst/*.pdf"
          commit_message: "chore(build): auto-build pdf"
          commit_user_name: "github-actions[bot]"
          commit_user_email: "github-actions[bot]@users.noreply.github.com"
          commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
