1name: Backport
2on:
3  pull_request_target:
4    types:
5      - closed
6      - labeled
7    branches:
8      - main
9
10jobs:
11  backport:
12    name: Backport
13    runs-on: ubuntu-22.04
14    # Only react to merged PRs for security reasons.
15    # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
16    if: >
17      github.event.pull_request.merged &&
18      (
19        github.event.action == 'closed' ||
20        (
21          github.event.action == 'labeled' &&
22          contains(github.event.label.name, 'backport')
23        )
24      )
25    steps:
26      - name: Backport
27        uses: zephyrproject-rtos/action-backport@v2.0.3-3
28        with:
29          github_token: ${{ secrets.ZB_GITHUB_TOKEN }}
30          issue_labels: Backport
31          labels_template: '["Backport"]'
32