name: Migrate Remote Plugin Issues

on:
  issues:
    types: [labeled]

permissions:
  issues: write

jobs:
  PluginSplit:
    if: startsWith(github.event.label.name, 'remote-plugin/')
    runs-on: ubuntu-latest
    steps:
      - uses: bflad/action-migrate-issue@2e049d822b08e67d25b938343227051518f14d9a # v1.0.2
        with:
          source-issue-comment: |
            This issue has been migrated to {target-issue-url} due to the [Packer Plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737).

            Please follow the new issue for updates.
          source-issue-skip-label-names: |
            core
            new-plugin-contribution
            website
          target-repository-name-prefix: 'packer-plugin-'
          target-repository-name-prefix-label-prefix: 'remote-plugin/'
          target-repository-github-token: ${{ secrets.PLUGIN_REPO_GITHUB_TOKEN }}
