name: Prepare Release

on: workflow_dispatch

permissions:
  contents: write
  pull-requests: write
  issues: write
  id-token: write

jobs:
  prepare-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      # We need to setup node because knope runs `npm run format` so we need to install prettier via npm
      - name: Set up Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: 24.x
          package-manager-cache: false

      - name: Install dependencies
        run: npm ci

      - name: Configure Git
        run: |
          git config --global user.name GitHub Actions
          git config user.email github-actions@github.com

      - uses: knope-dev/action@19617851f9f13ab2f27a05989c55efb18aca3675 # v2.1.2
        with:
          version: 0.22.0

      - run: knope prepare-release --verbose
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BASE_BRANCH: ${{ github.ref_name }}
