name: Backport PR on Label on: pull_request_target: types: - labeled # Permissions needed for the korthout/backport-action to create branches and PRs permissions: contents: write pull-requests: write jobs: backport: name: Create Backport PR runs-on: ubuntu-latest if: | github.event.pull_request.merged == true && startsWith(github.event.label.name, 'backport-') steps: - uses: actions/checkout@v5 with: ref: ${{ github.event.pull_request.head.sha }} token: ${{ steps.app-token.outputs.token }} - name: Backport Action uses: korthout/backport-action@v3 with: # Regex pattern for labels that should trigger a backport AND extracts the target branch # from the name (e.g. v0.x or v0.x.y; we use zerover). This action will ONLY proceed if # the label that triggered the workflow fully matches this pattern. # Example matching labels: "backport-v0.1", "backport-v0.10.1" # Example non-matching labels: "backport-foo", "backport-v1.0" label_pattern: '^backport-(v0\.\d+(\.\d+)?)$'