1name: Pull Request Assigner
2
3on:
4  pull_request_target:
5    types:
6    - opened
7    - synchronize
8    - reopened
9    - ready_for_review
10    branches:
11    - main
12    - collab-*
13    - v*-branch
14  issues:
15    types:
16    - labeled
17
18jobs:
19  assignment:
20    name: Pull Request Assignment
21    if: github.event.pull_request.draft == false
22    runs-on: ubuntu-22.04
23
24    steps:
25    - name: Install Python dependencies
26      run: |
27        pip install -U PyGithub>=1.55 west
28
29    - name: Check out source code
30      uses: actions/checkout@v4
31
32    - name: Run assignment script
33      env:
34        GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }}
35      run: |
36        FLAGS="-v"
37        FLAGS+=" -o ${{ github.event.repository.owner.login }}"
38        FLAGS+=" -r ${{ github.event.repository.name }}"
39        FLAGS+=" -M MAINTAINERS.yml"
40        if [ "${{ github.event_name }}" = "pull_request_target" ]; then
41            FLAGS+=" -P ${{ github.event.pull_request.number }}"
42        elif [ "${{ github.event_name }}" = "issues" ]; then
43            FLAGS+=" -I ${{ github.event.issue.number }}"
44        elif [ "${{ github.event_name }}" = "schedule" ]; then
45            FLAGS+=" --modules"
46        else
47          echo "Unknown event: ${{ github.event_name }}"
48          exit 1
49        fi
50
51        python3 scripts/set_assignees.py $FLAGS
52