name: 'Release: Create Minor Release PR'

on:
  workflow_dispatch:
  schedule:
    - cron: 0 8 * * 2 # 9am CET (UTC+1), Tuesday

jobs:
  create-release-pr:
    name: Create release PR
    uses: ./.github/workflows/release-create-pr.yml
    secrets: inherit
    with:
      base-branch: master
      release-type: minor

  notify-slack:
    name: Notify Slack
    needs: [create-release-pr]
    if: needs.create-release-pr.result == 'success' && needs.create-release-pr.outputs.pull-request-number != ''
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          sparse-checkout: .github/scripts/slack
          sparse-checkout-cone-mode: false
      - name: Notify Slack
        env:
          SLACK_TOKEN: ${{ secrets.RELEASE_HELPER_SLACK_TOKEN }}
        run: |
          node .github/scripts/slack/notify.mjs \
            --channel C036AELNMV0 \
            --text ':rocket: Minor release PR created. <${{ github.server_url }}/${{ github.repository }}/pull/${{ needs.create-release-pr.outputs.pull-request-number }}|View PR> — close it to cancel the release.'
