name: Check branch conformity
on:
  pull_request:
    types: ["opened", "labeled", "unlabeled", "reopened", "synchronize"]

jobs:
  prevent-fixup-commits:
      runs-on: ubuntu-latest
      env:
        target: debian-bookworm
        distro: debian
        version: bookworm
      steps:
        - name: Checkout
          uses: actions/checkout@v4
        - name: prevent fixup commits
          run: |
            git fetch origin
            git status
            git log --pretty=format:%s origin/main..HEAD | grep -ie '^fixup\|^wip' && exit 1 || true

  check-changelog:
    runs-on: ubuntu-latest
    name: Ensure CHANGELOG.md is populated for user-visible changes
    steps:
      # Pin the GitHub action to a specific commit that we have audited and know
      # how it works.
      - uses: tarides/changelog-check-action@509965da3b8ac786a5e2da30c2ccf9661189121f
        with:
          changelog: CHANGELOG.md
