---
name: Release Drafter

on:
  push:
    branches:
      - mealie-next
  # pull_request_target event is required for autolabeler to support PRs from forks
  pull_request_target:
    types: [opened, labeled, unlabeled, reopened, synchronize]
  workflow_dispatch:

jobs:
  draft_release:
    if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: release-drafter/release-drafter@v7
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  auto_label:
    if: github.event_name == 'pull_request_target'
    permissions:
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: release-drafter/release-drafter/autolabeler@v7
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
