name: Release Drafter

on:
    push:
        branches:
            - main

permissions:
    contents: read

jobs:
    correct_repository:
        permissions:
            contents: none
        runs-on: ubuntu-latest
        steps:
            - name: fail on fork
              if: github.repository_owner != 'kimai'
              run: exit 1

    update_release_draft:
        permissions:
            contents: write # for release-drafter/release-drafter to create a github release
            pull-requests: read
        needs: correct_repository
        runs-on: ubuntu-latest
        steps:
            - uses: release-drafter/release-drafter@v7
              env:
                  token: ${{ secrets.GITHUB_TOKEN }}
