name: Dependabot Changeset

on:
  pull_request_target:
    types: [opened, synchronize, labeled]

jobs:
  renovate:
    name: Update Dependabot PR
    runs-on: ubuntu-latest
    if: ${{ github.actor == 'dependabot[bot]' }}

    steps:
      - name: Generate a token
        id: gen_token
        uses: actions/create-github-app-token@v2
        with:
            app-id: ${{ secrets.SUBSTRATE_CONNECT_PR_APP_ID }}
            private-key: ${{ secrets.SUBSTRATE_CONNECT_PR_APP_KEY }}
            owner: ${{ github.repository_owner }}
      - uses: actions/checkout@v4.1.7
      - name: Update PR
        uses: mscharley/dependency-changesets-action@v1.1.9
        with:
          token: ${{ steps.gen_token.outputs.token }}
          use-conventional-commits: false
          author-name: GitHub Action
          author-email: action@github.com
