name: Inspect next changelogs

permissions:
  contents: write

on:
  workflow_dispatch:

jobs:
  generate:
    name: Generate changelogs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable

      - name: Build changelog generator
        run: cargo build --release -p changelog -- 

      - name: Read yew changelog in this step
        shell: bash
        run: ./target/release/changelog yew minor -t ${{ secrets.GITHUB_TOKEN }} -f "$(pwd)/CHANGELOG.md"

      - name: Read yew-router changelog in this step
        shell: bash
        run: ./target/release/changelog yew-router minor -t ${{ secrets.GITHUB_TOKEN }} -f "$(pwd)/CHANGELOG.md"

      - name: Read yew-agent changelog in this step
        shell: bash
        run: ./target/release/changelog yew-agent minor -t ${{ secrets.GITHUB_TOKEN }} -f "$(pwd)/CHANGELOG.md"
