name:  🤖 Automated Update tagpr config

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to release'
        required: true
jobs:
  config:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Update tagpr config
        run: |
          cat << EOF > .tagpr
          [tagpr]
              vPrefix = true
              releaseBranch = main
              versionFile = justfile
              command = just version-up ${{ github.event.inputs.version }}
              release = false
              changelog = true
          EOF
      - uses: peter-evans/create-pull-request@v5
        with:
          title: 'config: Automated Tagpr Update for ${{ github.event.inputs.version }}'
          add-paths: |
            .tagpr
          body: |
            
            Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
          commit-message: |
            🤖 update tagpr config using robot.
          branch: tagpr-${{ github.event.inputs.version }}
          base: main
          signoff: true
          delete-branch: true
          token: ${{ secrets.GITHUB_TOKEN }}
          committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
          author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
