name: Release Drafter

on:
  push:
    branches:
      - master
    tags:
      - 'v*'
  pull_request_target:
    types: [opened, reopened, synchronize]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  update_release_draft:
    permissions:
      contents: write
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: release-drafter/release-drafter@v6
        with:
          config-name: release-drafter.yml
          prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
