name: Changelog

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  changelog:
    if: github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]'
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Install Claude CLI
        run: npm install -g @anthropic-ai/claude-code
      - name: Check changelog
        uses: tempoxyz/changelogs/check@master
        with:
          ai: "claude -p"
          ecosystem: rust
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
