name: Backport PR Creator
on:
  pull_request_target:
    types:
      - closed
      - labeled

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Actions
        uses: actions/checkout@v4
        with:
          repository: "grafana/grafana-github-actions"
          path: ./actions
          # pin the version to before https://github.com/grafana/grafana-github-actions/pull/113 because
          # we don't want to have the same strict rules for PR labels
          ref: d284afd314ca3625c23595e9f62b52d215ead7ce
      - name: Install Actions
        run: npm install --production --prefix ./actions
      - name: Run backport
        uses: ./actions/backport
        with:
          token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
          labelsToAdd: "backport"
          title: "[{{base}}] {{originalTitle}}"