11name : Pull Request Assigner
22
33on :
4- pull_request_target :
4+ pull_request :
55 types :
66 - opened
77 - synchronize
@@ -24,41 +24,62 @@ jobs:
2424 if : github.event.pull_request.draft == false
2525 runs-on : ubuntu-24.04
2626 permissions :
27- pull-requests : write # to add assignees to pull requests
2827 issues : write # to add assignees to issues
2928
3029 steps :
31- - name : Check out source code
32- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+ - name : Check out source code
31+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
32+ with :
33+ fetch-depth : 0
34+ persist-credentials : false
3335
34- - name : Set up Python
35- uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
36- with :
37- python-version : 3.12
38- cache : pip
39- cache-dependency-path : scripts/requirements-actions.txt
36+ - name : Set up Python
37+ uses : zephyrproject-rtos/action-python-env@ace91a63fd503cd618ff1eb83fbcf302dabd7d44 # main
38+ with :
39+ python-version : 3.12
4040
41- - name : Install Python packages
42- run : |
43- pip install -r scripts/requirements-actions.txt --require-hashes
41+ - name : west setup
42+ if : >
43+ github.event_name == 'pull_request'
44+ run : |
45+ git config --global user.email "you@example.com"
46+ git config --global user.name "Your Name"
47+ west init -l . || true
48+ mkdir -p ./pr
4449
45- - name : Run assignment script
46- env :
47- GITHUB_TOKEN : ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }}
48- run : |
49- FLAGS="-v"
50- FLAGS+=" -o ${{ github.event.repository.owner.login }}"
51- FLAGS+=" -r ${{ github.event.repository.name }}"
52- FLAGS+=" -M MAINTAINERS.yml"
53- if [ "${{ github.event_name }}" = "pull_request_target" ]; then
54- FLAGS+=" -P ${{ github.event.pull_request.number }}"
55- elif [ "${{ github.event_name }}" = "issues" ]; then
50+ - name : Run assignment script
51+ env :
52+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53+ run : |
54+ FLAGS="-v"
55+ FLAGS+=" -o ${{ github.event.repository.owner.login }}"
56+ FLAGS+=" -r ${{ github.event.repository.name }}"
57+ FLAGS+=" -M MAINTAINERS.yml"
58+ if [ "${{ github.event_name }}" = "pull_request" ]; then
59+ FLAGS+=" -P ${{ github.event.pull_request.number }} --manifest -c origin/${{ github.base_ref }}.."
60+ python3 scripts/set_assignees.py $FLAGS
61+ cp -f manifest_areas.json ./pr/
62+ elif [ "${{ github.event_name }}" = "issues" ]; then
5663 FLAGS+=" -I ${{ github.event.issue.number }}"
57- elif [ "${{ github.event_name }}" = "schedule" ]; then
64+ python3 scripts/set_assignees.py $FLAGS
65+ elif [ "${{ github.event_name }}" = "schedule" ]; then
5866 FLAGS+=" --modules"
59- else
60- echo "Unknown event: ${{ github.event_name }}"
61- exit 1
62- fi
67+ python3 scripts/set_assignees.py $FLAGS
68+ else
69+ echo "Unknown event: ${{ github.event_name }}"
70+ exit 1
71+ fi
72+
73+
74+ - name : Save PR number
75+ if : >
76+ github.event_name == 'pull_request'
77+ run : |
78+ echo ${{ github.event.number }} > ./pr/NR
79+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
80+ if : >
81+ github.event_name == 'pull_request'
82+ with :
83+ name : pr
84+ path : pr/
6385
64- python3 scripts/set_assignees.py $FLAGS
0 commit comments