Skip to content

Commit 25ec04b

Browse files
committed
dump manifest
Signed-off-by: Anas Nashif <[email protected]>
1 parent 68ccdf0 commit 25ec04b

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

.github/workflows/assigner.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ jobs:
4646
pip install -r scripts/requirements-actions.txt --require-hashes
4747
4848
- name: west setup
49+
if: >
50+
github.event.workflow_run.event == 'pull_request'
4951
run: |
5052
git config --global user.email "[email protected]"
5153
git config --global user.name "Your Name"
5254
west init -l . || true
55+
mkdir -p ./pr
5356
5457
- name: Run assignment script
5558
env:
@@ -60,23 +63,25 @@ jobs:
6063
FLAGS+=" -r ${{ github.event.repository.name }}"
6164
FLAGS+=" -M MAINTAINERS.yml"
6265
if [ "${{ github.event_name }}" = "pull_request" ]; then
63-
FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.."
66+
FLAGS+=" -P ${{ github.event.pull_request.number }} --manifest -c origin/${{ github.base_ref }}.."
67+
python3 scripts/set_assignees.py $FLAGS
68+
cp -f manifest_areas.json ./pr/
6469
elif [ "${{ github.event_name }}" = "issues" ]; then
6570
FLAGS+=" -I ${{ github.event.issue.number }}"
71+
python3 scripts/set_assignees.py $FLAGS
6672
elif [ "${{ github.event_name }}" = "schedule" ]; then
6773
FLAGS+=" --modules"
74+
python3 scripts/set_assignees.py $FLAGS
6875
else
6976
echo "Unknown event: ${{ github.event_name }}"
7077
exit 1
7178
fi
7279
73-
python3 scripts/set_assignees.py $FLAGS
7480
7581
- name: Save PR number
7682
if: >
7783
github.event.workflow_run.event == 'pull_request'
7884
run: |
79-
mkdir -p ./pr
8085
echo ${{ github.event.number }} > ./pr/NR
8186
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8287
if: >

scripts/set_assignees.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def parse_args():
5757
parser.add_argument("-c", "--commits", default=None,
5858
help="Commit range in the form: a..b")
5959

60+
parser.add_argument("-m", "--manifest", action="store_true", default=False,
61+
help="Dump manifest changes")
62+
6063
parser.add_argument("-v", "--verbose", action="count", default=0,
6164
help="Verbose Output")
6265

@@ -94,6 +97,28 @@ def process_manifest():
9497
log(f'manifest areas: {areas}')
9598
return areas
9699

100+
101+
def dump_manifest_changes(gh, maintainer_file, pr):
102+
gh_repo = gh.get_repo(f"{args.org}/{args.repo}")
103+
pr = gh_repo.get_pull(number)
104+
fn = list(pr.get_files())
105+
areas = set()
106+
for changed_file in fn:
107+
log(f"file: {changed_file.filename}")
108+
109+
if changed_file.filename in ['west.yml','submanifests/optional.yaml']:
110+
changed_areas = process_manifest()
111+
for _area in changed_areas:
112+
area_match = maintainer_file.name2areas(_area)
113+
if area_match:
114+
areas.extend(area_match)
115+
116+
log(f"Areas: {areas}")
117+
# now dump the list of areas into a json file
118+
import json
119+
with open("manifest_areas.json", "w") as f:
120+
json.dump([area.name for area in areas], f, indent=4)
121+
97122
def process_pr(gh, maintainer_file, number):
98123

99124
gh_repo = gh.get_repo(f"{args.org}/{args.repo}")
@@ -402,7 +427,9 @@ def main():
402427
gh = Github(token)
403428
maintainer_file = Maintainers(args.maintainer_file)
404429

405-
if args.pull_request:
430+
if args.pull_request and args.manifest:
431+
dump_manifest_changes(gh, maintainer_file)
432+
elif args.pull_request:
406433
process_pr(gh, maintainer_file, args.pull_request)
407434
elif args.issue:
408435
process_issue(gh, maintainer_file, args.issue)

0 commit comments

Comments
 (0)