From 9bfa038be41989bc97bd94a15dc08c96f5fc2a7f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 1 Sep 2025 13:33:07 -0400 Subject: [PATCH 01/38] upload test results to codecov Signed-off-by: Anas Nashif --- .github/workflows/twister.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index d5f214be9fb..0bf67cd51ad 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -360,6 +360,12 @@ jobs: junit.html junit.xml + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0 with: From 843afbb7ac2ac7a0b70a249717a0b833b1eeece7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 1 Sep 2025 13:35:40 -0400 Subject: [PATCH 02/38] limit to kernel tests Signed-off-by: Anas Nashif --- .github/workflows/twister.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 0bf67cd51ad..ae0b19ee482 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -238,7 +238,7 @@ jobs: run: | export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS} + ./scripts/twister -T tests/kernel --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS} if [ "${{matrix.subset}}" = "1" ]; then ./scripts/zephyr_module.py --twister-out module_tests.args if [ -s module_tests.args ]; then From dc6e063d12c7299f92b1d4b522ae2aad29dc946e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 1 Sep 2025 14:14:48 -0400 Subject: [PATCH 03/38] only on push Signed-off-by: Anas Nashif --- .github/workflows/twister.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index ae0b19ee482..706359a28b8 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -361,7 +361,7 @@ jobs: junit.xml - name: Upload test results to Codecov - if: ${{ !cancelled() }} + if: ${{ !cancelled() && (github.event_name == 'push') }} uses: codecov/test-results-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} From 4f221d7dd69e27fedf4fe847be6a8d73de999140 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 1 Sep 2025 14:14:57 -0400 Subject: [PATCH 04/38] Revert "limit to kernel tests" This reverts commit fa897f3223702511c55af210b9dd4aa3780f6b49. --- .github/workflows/twister.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 706359a28b8..6f9a4bbc1c4 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -238,7 +238,7 @@ jobs: run: | export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - ./scripts/twister -T tests/kernel --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS} + ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS} if [ "${{matrix.subset}}" = "1" ]; then ./scripts/zephyr_module.py --twister-out module_tests.args if [ -s module_tests.args ]; then From bddef561b84411aed8fa3dbb1183fc109d7c28ab Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 07:41:22 -0400 Subject: [PATCH 05/38] scripts/get_maintainer.py: find area by name Find an area by name. Signed-off-by: Anas Nashif --- scripts/get_maintainer.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/get_maintainer.py b/scripts/get_maintainer.py index 855a6bf3950..7ca14d9a773 100755 --- a/scripts/get_maintainer.py +++ b/scripts/get_maintainer.py @@ -109,6 +109,18 @@ def _parse_args(): nargs="?", help="List all areas maintained by maintainer.") + + area_parser = subparsers.add_parser( + "area", + help="List area(s) by name") + area_parser.add_argument( + "name", + metavar="AREA", + nargs="?", + help="List all areas with the given name.") + + area_parser.set_defaults(cmd_fn=Maintainers._area_cmd) + # New arguments for filtering areas_parser.add_argument( "--without-maintainers", @@ -220,6 +232,12 @@ def __init__(self, filename=None): self.areas[area_name] = area + def name2areas(self, name): + """ + Returns a list of Area instances for the areas that match 'name'. + """ + return [area for area in self.areas.values() if area.name == name] + def path2areas(self, path): """ Returns a list of Area instances for the areas that contain 'path', @@ -262,6 +280,14 @@ def __repr__(self): # Command-line subcommands # + def _area_cmd(self, args): + # 'area' subcommand implementation + + res = set() + areas = self.name2areas(args.name) + res.update(areas) + _print_areas(res) + def _path_cmd(self, args): # 'path' subcommand implementation From 8721d8f28c3c261b168b896aba544866c143010f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 1 Sep 2025 22:04:03 -0400 Subject: [PATCH 06/38] scripts/set_assignees.py: also set assignee on manifest changes Parse manifest for changes and set assignees for any manifest entries that has changed. Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 54 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index a428f102cfe..9ec7cda8fca 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -13,11 +13,15 @@ from collections import defaultdict from west.manifest import Manifest from west.manifest import ManifestProject +from git import Repo +from pathlib import Path TOP_DIR = os.path.join(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(TOP_DIR, "scripts")) from get_maintainer import Maintainers +zephyr_base = os.getenv('ZEPHYR_BASE', os.path.join(TOP_DIR, '..')) + def log(s): if args.verbose > 0: print(s, file=sys.stdout) @@ -50,11 +54,46 @@ def parse_args(): parser.add_argument("-r", "--repo", default="zephyr", help="Github repository") + parser.add_argument("-c", "--commits", default=None, + help="Commit range in the form: a..b") + parser.add_argument("-v", "--verbose", action="count", default=0, help="Verbose Output") args = parser.parse_args() + +def process_manifest(): + repo = Repo(zephyr_base) + old_manifest_content = repo.git.show(f"{args.commits[:-2]}:west.yml") + with open("west_old.yml", "w") as manifest: + manifest.write(old_manifest_content) + old_manifest = Manifest.from_file("west_old.yml") + new_manifest = Manifest.from_file("west.yml") + old_projs = set((p.name, p.revision) for p in old_manifest.projects) + new_projs = set((p.name, p.revision) for p in new_manifest.projects) + # Removed projects + rprojs = set(filter(lambda p: p[0] not in list(p[0] for p in new_projs), + old_projs - new_projs)) + # Updated projects + uprojs = set(filter(lambda p: p[0] in list(p[0] for p in old_projs), + new_projs - old_projs)) + # Added projects + aprojs = new_projs - old_projs - uprojs + + # All projs + projs = rprojs | uprojs | aprojs + projs_names = [name for name, rev in projs] + + if not projs_names: + return + areas = [] + for p in projs_names: + areas.append(f'West project: {p}') + + log(f'manifest areas: {areas}') + return areas + def process_pr(gh, maintainer_file, number): gh_repo = gh.get_repo(f"{args.org}/{args.repo}") @@ -70,10 +109,6 @@ def process_pr(gh, maintainer_file, number): all_areas = set() fn = list(pr.get_files()) - for changed_file in fn: - if changed_file.filename in ['west.yml','submanifests/optional.yaml']: - break - if pr.commits == 1 and (pr.additions <= 1 and pr.deletions <= 1): labels = {'size: XS'} @@ -84,7 +119,16 @@ def process_pr(gh, maintainer_file, number): for changed_file in fn: num_files += 1 log(f"file: {changed_file.filename}") - areas = maintainer_file.path2areas(changed_file.filename) + + areas = [] + if changed_file.filename in ['west.yml','submanifests/optional.yaml']: + changed_areas = process_manifest() + for _area in changed_areas: + area_match = maintainer_file.name2areas(_area) + if area_match: + areas.extend(area_match) + else: + areas = maintainer_file.path2areas(changed_file.filename) if not areas: continue From ec786c0c21cbef7f113f319631ac676d6c25e344 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 07:50:35 -0400 Subject: [PATCH 07/38] ci: add commit range argument Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index a986067d5f8..e3f9fffab16 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -51,7 +51,7 @@ jobs: FLAGS+=" -r ${{ github.event.repository.name }}" FLAGS+=" -M MAINTAINERS.yml" if [ "${{ github.event_name }}" = "pull_request_target" ]; then - FLAGS+=" -P ${{ github.event.pull_request.number }}" + FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." elif [ "${{ github.event_name }}" = "issues" ]; then FLAGS+=" -I ${{ github.event.issue.number }}" elif [ "${{ github.event_name }}" = "schedule" ]; then From 56226b046567b6f02b566d9b475ba8f3b4eb220b Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 08:00:02 -0400 Subject: [PATCH 08/38] init west Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index e3f9fffab16..3b90dca89f6 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -46,6 +46,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | + west init -l . || true FLAGS="-v" FLAGS+=" -o ${{ github.event.repository.owner.login }}" FLAGS+=" -r ${{ github.event.repository.name }}" From 8c8c1a986d9e739af8669316530a86f59eeb5f2f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 08:13:20 -0400 Subject: [PATCH 09/38] logging Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 9ec7cda8fca..e4e8671cd80 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -64,6 +64,7 @@ def parse_args(): def process_manifest(): + log("Processing manifest changes") repo = Repo(zephyr_base) old_manifest_content = repo.git.show(f"{args.commits[:-2]}:west.yml") with open("west_old.yml", "w") as manifest: @@ -85,8 +86,7 @@ def process_manifest(): projs = rprojs | uprojs | aprojs projs_names = [name for name, rev in projs] - if not projs_names: - return + log(f"found modified projects: {projs_names}") areas = [] for p in projs_names: areas.append(f'West project: {p}') From 9fe72ce03bf50a8827624d3acec85ea80afa574b Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 08:28:40 -0400 Subject: [PATCH 10/38] some debug Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 3b90dca89f6..b50c0b77d1a 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -47,6 +47,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | west init -l . || true + git log | head -n 10 + git diff origin/${{ github.base_ref }}.. + FLAGS="-v" FLAGS+=" -o ${{ github.event.repository.owner.login }}" FLAGS+=" -r ${{ github.event.repository.name }}" From 5957f4128ae69f4cbb15658e247772cc560969b4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 08:54:11 -0400 Subject: [PATCH 11/38] sha Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index b50c0b77d1a..07e2e13e26c 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -30,6 +30,10 @@ jobs: steps: - name: Check out source code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + persist-credentials: false - name: Set up Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 From 10eefa8ecb3565d689e852393f3d024a512cfc43 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:37:43 -0400 Subject: [PATCH 12/38] split workflow Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 81 +++++++++++++++++++++++++ .github/workflows/assigner.yml | 23 ++++--- 2 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/assigner-workflow.yml diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml new file mode 100644 index 00000000000..ebb94f65a64 --- /dev/null +++ b/.github/workflows/assigner-workflow.yml @@ -0,0 +1,81 @@ +name: Pull Request Assigner Completion Workflow + +# read-write repo token +# access to secrets +on: + workflow_run: + workflows: ["Pull Request Assigner"] + types: + - completed + +permissions: + contents: read + +jobs: + assignment: + name: Pull Request Assignment + runs-on: ubuntu-24.04 + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + + steps: + - name: 'Download artifact' + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); + - run: unzip pr.zip + + - name: Check out source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: 3.12 + cache: pip + cache-dependency-path: scripts/requirements-actions.txt + + - name: Install Python packages + run: | + pip install -r scripts/requirements-actions.txt --require-hashes + + - name: Run assignment script + env: + GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} + run: | + FLAGS="-v" + FLAGS+=" -o ${{ github.event.repository.owner.login }}" + FLAGS+=" -r ${{ github.event.repository.name }}" + FLAGS+=" -M MAINTAINERS.yml" + if [ "${{ github.event_name }}" = "pull_request_target" ]; then + FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." + elif [ "${{ github.event_name }}" = "issues" ]; then + FLAGS+=" -I ${{ github.event.issue.number }}" + elif [ "${{ github.event_name }}" = "schedule" ]; then + FLAGS+=" --modules" + else + echo "Unknown event: ${{ github.event_name }}" + exit 1 + fi + + python3 scripts/set_assignees.py $FLAGS diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 07e2e13e26c..e47db4af040 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -1,7 +1,7 @@ name: Pull Request Assigner on: - pull_request_target: + pull_request: types: - opened - synchronize @@ -31,7 +31,6 @@ jobs: - name: Check out source code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 persist-credentials: false @@ -50,15 +49,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | - west init -l . || true - git log | head -n 10 - git diff origin/${{ github.base_ref }}.. - FLAGS="-v" FLAGS+=" -o ${{ github.event.repository.owner.login }}" FLAGS+=" -r ${{ github.event.repository.name }}" FLAGS+=" -M MAINTAINERS.yml" - if [ "${{ github.event_name }}" = "pull_request_target" ]; then + if [ "${{ github.event_name }}" = "pull_request" ]; then FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." elif [ "${{ github.event_name }}" = "issues" ]; then FLAGS+=" -I ${{ github.event.issue.number }}" @@ -70,3 +65,17 @@ jobs: fi python3 scripts/set_assignees.py $FLAGS + + - name: Save PR number + if: > + github.event.workflow_run.event == 'pull_request' + run: | + mkdir -p ./pr + echo ${{ github.event.number }} > ./pr/NR + - uses: actions/upload-artifact@v2 + if: > + github.event.workflow_run.event == 'pull_request' + with: + name: pr + path: pr/ + From a587b90dde4f5f4dc4b20ffd2946fa26dd873310 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:40:31 -0400 Subject: [PATCH 13/38] fix layout Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 106 ++++++++++++------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index ebb94f65a64..050ebfdd641 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -20,62 +20,62 @@ jobs: github.event.workflow_run.conclusion == 'success' steps: - - name: 'Download artifact' - uses: actions/github-script@v3.1.0 - with: - script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); - - run: unzip pr.zip + - name: 'Download artifact' + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); + - run: unzip pr.zip - - name: Check out source code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - persist-credentials: false + - name: Check out source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: 3.12 - cache: pip - cache-dependency-path: scripts/requirements-actions.txt + - name: Set up Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: 3.12 + cache: pip + cache-dependency-path: scripts/requirements-actions.txt - - name: Install Python packages - run: | - pip install -r scripts/requirements-actions.txt --require-hashes + - name: Install Python packages + run: | + pip install -r scripts/requirements-actions.txt --require-hashes - - name: Run assignment script - env: - GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} - run: | - FLAGS="-v" - FLAGS+=" -o ${{ github.event.repository.owner.login }}" - FLAGS+=" -r ${{ github.event.repository.name }}" - FLAGS+=" -M MAINTAINERS.yml" - if [ "${{ github.event_name }}" = "pull_request_target" ]; then - FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." - elif [ "${{ github.event_name }}" = "issues" ]; then - FLAGS+=" -I ${{ github.event.issue.number }}" - elif [ "${{ github.event_name }}" = "schedule" ]; then - FLAGS+=" --modules" - else - echo "Unknown event: ${{ github.event_name }}" + - name: Run assignment script + env: + GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} + run: | + FLAGS="-v" + FLAGS+=" -o ${{ github.event.repository.owner.login }}" + FLAGS+=" -r ${{ github.event.repository.name }}" + FLAGS+=" -M MAINTAINERS.yml" + if [ "${{ github.event_name }}" = "pull_request_target" ]; then + FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." + elif [ "${{ github.event_name }}" = "issues" ]; then + FLAGS+=" -I ${{ github.event.issue.number }}" + elif [ "${{ github.event_name }}" = "schedule" ]; then + FLAGS+=" --modules" + else + echo "Unknown event: ${{ github.event_name }}" exit 1 - fi + fi - python3 scripts/set_assignees.py $FLAGS + python3 scripts/set_assignees.py $FLAGS From 6e728fc9592bd730ea175742ea7e59bb4ac96dfe Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:42:10 -0400 Subject: [PATCH 14/38] fix layout Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 38 +++++------ .github/workflows/assigner.yml | 84 ++++++++++++------------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 050ebfdd641..b93e4e341d9 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -26,20 +26,20 @@ jobs: script: | var artifacts = await github.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); - run: unzip pr.zip - name: Check out source code @@ -68,14 +68,14 @@ jobs: FLAGS+=" -r ${{ github.event.repository.name }}" FLAGS+=" -M MAINTAINERS.yml" if [ "${{ github.event_name }}" = "pull_request_target" ]; then - FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." + FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." elif [ "${{ github.event_name }}" = "issues" ]; then - FLAGS+=" -I ${{ github.event.issue.number }}" + FLAGS+=" -I ${{ github.event.issue.number }}" elif [ "${{ github.event_name }}" = "schedule" ]; then - FLAGS+=" --modules" + FLAGS+=" --modules" else - echo "Unknown event: ${{ github.event_name }}" - exit 1 + echo "Unknown event: ${{ github.event_name }}" + exit 1 fi python3 scripts/set_assignees.py $FLAGS diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index e47db4af040..5709814376b 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -28,54 +28,54 @@ jobs: issues: write # to add assignees to issues steps: - - name: Check out source code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - persist-credentials: false + - name: Check out source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: 3.12 - cache: pip - cache-dependency-path: scripts/requirements-actions.txt + - name: Set up Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: 3.12 + cache: pip + cache-dependency-path: scripts/requirements-actions.txt - - name: Install Python packages - run: | - pip install -r scripts/requirements-actions.txt --require-hashes + - name: Install Python packages + run: | + pip install -r scripts/requirements-actions.txt --require-hashes - - name: Run assignment script - env: - GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} - run: | - FLAGS="-v" - FLAGS+=" -o ${{ github.event.repository.owner.login }}" - FLAGS+=" -r ${{ github.event.repository.name }}" - FLAGS+=" -M MAINTAINERS.yml" - if [ "${{ github.event_name }}" = "pull_request" ]; then + - name: Run assignment script + env: + GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} + run: | + FLAGS="-v" + FLAGS+=" -o ${{ github.event.repository.owner.login }}" + FLAGS+=" -r ${{ github.event.repository.name }}" + FLAGS+=" -M MAINTAINERS.yml" + if [ "${{ github.event_name }}" = "pull_request" ]; then FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." - elif [ "${{ github.event_name }}" = "issues" ]; then + elif [ "${{ github.event_name }}" = "issues" ]; then FLAGS+=" -I ${{ github.event.issue.number }}" - elif [ "${{ github.event_name }}" = "schedule" ]; then + elif [ "${{ github.event_name }}" = "schedule" ]; then FLAGS+=" --modules" - else - echo "Unknown event: ${{ github.event_name }}" - exit 1 - fi + else + echo "Unknown event: ${{ github.event_name }}" + exit 1 + fi - python3 scripts/set_assignees.py $FLAGS + python3 scripts/set_assignees.py $FLAGS - - name: Save PR number - if: > - github.event.workflow_run.event == 'pull_request' - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NR - - uses: actions/upload-artifact@v2 - if: > - github.event.workflow_run.event == 'pull_request' - with: - name: pr - path: pr/ + - name: Save PR number + if: > + github.event.workflow_run.event == 'pull_request' + run: | + mkdir -p ./pr + echo ${{ github.event.number }} > ./pr/NR + - uses: actions/upload-artifact@v2 + if: > + github.event.workflow_run.event == 'pull_request' + with: + name: pr + path: pr/ From 5040c2c4c82b212e9e23c6fb211e71a5f081f77c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:49:46 -0400 Subject: [PATCH 15/38] fix versions Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 2 +- .github/workflows/assigner.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index b93e4e341d9..606d2bd0075 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -21,7 +21,7 @@ jobs: steps: - name: 'Download artifact' - uses: actions/github-script@v3.1.0 + uses: actions/github-script@v8.0.0 # v8.0.0 with: script: | var artifacts = await github.actions.listWorkflowRunArtifacts({ diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 5709814376b..c9fdef225c1 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -72,7 +72,7 @@ jobs: run: | mkdir -p ./pr echo ${{ github.event.number }} > ./pr/NR - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: > github.event.workflow_run.event == 'pull_request' with: From 82f0fdb7bb1aea214ec26f1855882c0b36a710f4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:53:28 -0400 Subject: [PATCH 16/38] token Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index c9fdef225c1..b3b58040402 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -47,7 +47,7 @@ jobs: - name: Run assignment script env: - GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | FLAGS="-v" FLAGS+=" -o ${{ github.event.repository.owner.login }}" From c383c271b9f70a5a5a74e0ecab7af7bf6cd7cb43 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:56:20 -0400 Subject: [PATCH 17/38] west setup Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index b3b58040402..afdbe54144c 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -45,6 +45,15 @@ jobs: run: | pip install -r scripts/requirements-actions.txt --require-hashes + - name: west setup + env: + BASE_REF: ${{ github.base_ref }} + working-directory: zephyrproject/zephyr + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + west init -l . || true + - name: Run assignment script env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 68ccdf0294c1d34c979e33cfbbf09a1614e1773c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 08:59:40 -0400 Subject: [PATCH 18/38] wd Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index afdbe54144c..7f2ba3cb590 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -46,9 +46,6 @@ jobs: pip install -r scripts/requirements-actions.txt --require-hashes - name: west setup - env: - BASE_REF: ${{ github.base_ref }} - working-directory: zephyrproject/zephyr run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" From 25ec04b0d19af2b2d12ae1c5c65a2931749132a4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:21:33 -0400 Subject: [PATCH 19/38] dump manifest Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 11 ++++++++--- scripts/set_assignees.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 7f2ba3cb590..4b2da785ee8 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -46,10 +46,13 @@ jobs: pip install -r scripts/requirements-actions.txt --require-hashes - name: west setup + if: > + github.event.workflow_run.event == 'pull_request' run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" west init -l . || true + mkdir -p ./pr - name: Run assignment script env: @@ -60,23 +63,25 @@ jobs: FLAGS+=" -r ${{ github.event.repository.name }}" FLAGS+=" -M MAINTAINERS.yml" if [ "${{ github.event_name }}" = "pull_request" ]; then - FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." + FLAGS+=" -P ${{ github.event.pull_request.number }} --manifest -c origin/${{ github.base_ref }}.." + python3 scripts/set_assignees.py $FLAGS + cp -f manifest_areas.json ./pr/ elif [ "${{ github.event_name }}" = "issues" ]; then FLAGS+=" -I ${{ github.event.issue.number }}" + python3 scripts/set_assignees.py $FLAGS elif [ "${{ github.event_name }}" = "schedule" ]; then FLAGS+=" --modules" + python3 scripts/set_assignees.py $FLAGS else echo "Unknown event: ${{ github.event_name }}" exit 1 fi - python3 scripts/set_assignees.py $FLAGS - name: Save PR number if: > github.event.workflow_run.event == 'pull_request' run: | - mkdir -p ./pr echo ${{ github.event.number }} > ./pr/NR - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: > diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index e4e8671cd80..3a83f7f02f1 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -57,6 +57,9 @@ def parse_args(): parser.add_argument("-c", "--commits", default=None, help="Commit range in the form: a..b") + parser.add_argument("-m", "--manifest", action="store_true", default=False, + help="Dump manifest changes") + parser.add_argument("-v", "--verbose", action="count", default=0, help="Verbose Output") @@ -94,6 +97,28 @@ def process_manifest(): log(f'manifest areas: {areas}') return areas + +def dump_manifest_changes(gh, maintainer_file, pr): + gh_repo = gh.get_repo(f"{args.org}/{args.repo}") + pr = gh_repo.get_pull(number) + fn = list(pr.get_files()) + areas = set() + for changed_file in fn: + log(f"file: {changed_file.filename}") + + if changed_file.filename in ['west.yml','submanifests/optional.yaml']: + changed_areas = process_manifest() + for _area in changed_areas: + area_match = maintainer_file.name2areas(_area) + if area_match: + areas.extend(area_match) + + log(f"Areas: {areas}") + # now dump the list of areas into a json file + import json + with open("manifest_areas.json", "w") as f: + json.dump([area.name for area in areas], f, indent=4) + def process_pr(gh, maintainer_file, number): gh_repo = gh.get_repo(f"{args.org}/{args.repo}") @@ -402,7 +427,9 @@ def main(): gh = Github(token) maintainer_file = Maintainers(args.maintainer_file) - if args.pull_request: + if args.pull_request and args.manifest: + dump_manifest_changes(gh, maintainer_file) + elif args.pull_request: process_pr(gh, maintainer_file, args.pull_request) elif args.issue: process_issue(gh, maintainer_file, args.issue) From cd505181e67899f16a555aabb5e6bd124dc7bc08 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:29:06 -0400 Subject: [PATCH 20/38] conflicting -m Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 3a83f7f02f1..955046dc5a2 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -57,7 +57,7 @@ def parse_args(): parser.add_argument("-c", "--commits", default=None, help="Commit range in the form: a..b") - parser.add_argument("-m", "--manifest", action="store_true", default=False, + parser.add_argument("--manifest", action="store_true", default=False, help="Dump manifest changes") parser.add_argument("-v", "--verbose", action="count", default=0, From 18641b8e4d7d4656fd25209fc6b4097ea53b637b Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:31:51 -0400 Subject: [PATCH 21/38] pr Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 955046dc5a2..9a25eec33fe 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -428,7 +428,7 @@ def main(): maintainer_file = Maintainers(args.maintainer_file) if args.pull_request and args.manifest: - dump_manifest_changes(gh, maintainer_file) + dump_manifest_changes(gh, maintainer_file, args.pull_request) elif args.pull_request: process_pr(gh, maintainer_file, args.pull_request) elif args.issue: From 4e95b63bbf8cafee4740e94dc0c927151b01776e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:34:10 -0400 Subject: [PATCH 22/38] pr Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 9a25eec33fe..c5456b66ce9 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -98,7 +98,7 @@ def process_manifest(): return areas -def dump_manifest_changes(gh, maintainer_file, pr): +def dump_manifest_changes(gh, maintainer_file, number): gh_repo = gh.get_repo(f"{args.org}/{args.repo}") pr = gh_repo.get_pull(number) fn = list(pr.get_files()) From 626b6814698a2893c03277a82bf53bf1c60e81ca Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:48:33 -0400 Subject: [PATCH 23/38] event Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 4b2da785ee8..b292d5e5ab0 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -47,7 +47,7 @@ jobs: - name: west setup if: > - github.event.workflow_run.event == 'pull_request' + github.event_name == 'pull_request' run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" From a27517cfea94691508028be74063f50a735dbf9f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:52:05 -0400 Subject: [PATCH 24/38] set Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index c5456b66ce9..73bef4355d2 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -8,6 +8,7 @@ import os import time import datetime +import json from github import Github, GithubException from github.GithubException import UnknownObjectException from collections import defaultdict @@ -102,7 +103,7 @@ def dump_manifest_changes(gh, maintainer_file, number): gh_repo = gh.get_repo(f"{args.org}/{args.repo}") pr = gh_repo.get_pull(number) fn = list(pr.get_files()) - areas = set() + areas = [] for changed_file in fn: log(f"file: {changed_file.filename}") @@ -115,7 +116,6 @@ def dump_manifest_changes(gh, maintainer_file, number): log(f"Areas: {areas}") # now dump the list of areas into a json file - import json with open("manifest_areas.json", "w") as f: json.dump([area.name for area in areas], f, indent=4) From c6eddd9c3d6d60b22e82f2a17e91cec40acae49f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 09:58:09 -0400 Subject: [PATCH 25/38] event Signed-off-by: Anas Nashif --- .github/workflows/assigner.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index b292d5e5ab0..7cdca3ca391 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -80,12 +80,12 @@ jobs: - name: Save PR number if: > - github.event.workflow_run.event == 'pull_request' + github.event_name == 'pull_request' run: | echo ${{ github.event.number }} > ./pr/NR - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: > - github.event.workflow_run.event == 'pull_request' + github.event_name == 'pull_request' with: name: pr path: pr/ From d7e004f5cc684b6aaacd4ab6888f9e358dff9df1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 10:13:15 -0400 Subject: [PATCH 26/38] space Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 606d2bd0075..b8aa351d564 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -4,7 +4,7 @@ name: Pull Request Assigner Completion Workflow # access to secrets on: workflow_run: - workflows: ["Pull Request Assigner"] + workflows: ["Pull Request Assigner"] types: - completed From a24f443998dac07fbe305ea98796c5627f5325a9 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 10:32:40 -0400 Subject: [PATCH 27/38] workflow Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 49 +++++++++++++++---------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index b8aa351d564..109956063e6 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -20,27 +20,38 @@ jobs: github.event.workflow_run.conclusion == 'success' steps: - - name: 'Download artifact' - uses: actions/github-script@v8.0.0 # v8.0.0 + - name: Download artifacts + id: download-artifacts + uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 + with: + workflow: doc-build.yml + run_id: ${{ github.event.workflow_run.id }} + if_no_artifact_found: ignore + + - name: Load PR number + if: steps.download-artifacts.outputs.found_artifact == 'true' + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr" - })[0]; - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); - - run: unzip pr.zip + let fs = require("fs"); + let pr_number = Number(fs.readFileSync("./NR")); + core.exportVariable("PR_NUM", pr_number); + + - name: Check PR number + if: steps.download-artifacts.outputs.found_artifact == 'true' + id: check-pr + uses: carpentries/actions/check-valid-pr@2e20fd5ee53b691e27455ce7ca3b16ea885140e8 # v0.15.0 + with: + pr: ${{ env.PR_NUM }} + sha: ${{ github.event.workflow_run.head_sha }} + + - name: Validate PR number + if: | + steps.download-artifacts.outputs.found_artifact == 'true' && + steps.check-pr.outputs.VALID != 'true' + run: | + echo "ABORT: PR number validation failed!" + exit 1 - name: Check out source code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From ceba4ab13735e6a9b321a39a05a993384e1a69e1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 10:36:14 -0400 Subject: [PATCH 28/38] validate nr Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 109956063e6..477ca461770 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -34,7 +34,7 @@ jobs: with: script: | let fs = require("fs"); - let pr_number = Number(fs.readFileSync("./NR")); + let pr_number = Number(fs.readFileSync("./pr/NR")); core.exportVariable("PR_NUM", pr_number); - name: Check PR number From 43e1bfc54fbbb07632c361e2c9977573162fdd56 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 10:45:13 -0400 Subject: [PATCH 29/38] workflow Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 18 ++---------------- scripts/set_assignees.py | 10 +++------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 477ca461770..2e785212801 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -74,19 +74,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | - FLAGS="-v" - FLAGS+=" -o ${{ github.event.repository.owner.login }}" - FLAGS+=" -r ${{ github.event.repository.name }}" - FLAGS+=" -M MAINTAINERS.yml" - if [ "${{ github.event_name }}" = "pull_request_target" ]; then - FLAGS+=" -P ${{ github.event.pull_request.number }} -c origin/${{ github.base_ref }}.." - elif [ "${{ github.event_name }}" = "issues" ]; then - FLAGS+=" -I ${{ github.event.issue.number }}" - elif [ "${{ github.event_name }}" = "schedule" ]; then - FLAGS+=" --modules" - else - echo "Unknown event: ${{ github.event_name }}" - exit 1 - fi - - python3 scripts/set_assignees.py $FLAGS + cat ./pr/manifest_areas.json + python3 scripts/set_assignees.py -P ${{ env.PR_NUM }} -M MAINTAINERS.yml -v diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 73bef4355d2..cdb52fe1896 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -147,13 +147,9 @@ def process_pr(gh, maintainer_file, number): areas = [] if changed_file.filename in ['west.yml','submanifests/optional.yaml']: - changed_areas = process_manifest() - for _area in changed_areas: - area_match = maintainer_file.name2areas(_area) - if area_match: - areas.extend(area_match) - else: - areas = maintainer_file.path2areas(changed_file.filename) + continue + + areas = maintainer_file.path2areas(changed_file.filename) if not areas: continue From 7600778080100c399aff9d3a289842b9de8ba145 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 11:04:47 -0400 Subject: [PATCH 30/38] checkout Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 2e785212801..420f95c9104 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -20,11 +20,16 @@ jobs: github.event.workflow_run.conclusion == 'success' steps: + - name: Check out source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false - name: Download artifacts id: download-artifacts uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 with: - workflow: doc-build.yml + workflow: assigner.yml run_id: ${{ github.event.workflow_run.id }} if_no_artifact_found: ignore @@ -53,11 +58,6 @@ jobs: echo "ABORT: PR number validation failed!" exit 1 - - name: Check out source code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - persist-credentials: false - name: Set up Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 From 47fe9ff3bb00e1bedfdd8d1619aac5312b4aad52 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 12:02:47 -0400 Subject: [PATCH 31/38] load areas Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 3 ++- scripts/set_assignees.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 420f95c9104..13f2010065e 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -75,4 +75,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | cat ./pr/manifest_areas.json - python3 scripts/set_assignees.py -P ${{ env.PR_NUM }} -M MAINTAINERS.yml -v + python3 scripts/set_assignees.py -P ${{ env.PR_NUM }} -M MAINTAINERS.yml -v \ + --repo ${{ github.event.repository.name }} diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index cdb52fe1896..dfabda04980 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -61,6 +61,9 @@ def parse_args(): parser.add_argument("--manifest", action="store_true", default=False, help="Dump manifest changes") + parser.add_argument("--areas", default=None, + help="Load list of areas from file generated by --manifest") + parser.add_argument("-v", "--verbose", action="count", default=0, help="Verbose Output") @@ -131,7 +134,6 @@ def process_pr(gh, maintainer_file, number): found_maintainers = defaultdict(int) num_files = 0 - all_areas = set() fn = list(pr.get_files()) if pr.commits == 1 and (pr.additions <= 1 and pr.deletions <= 1): @@ -154,7 +156,6 @@ def process_pr(gh, maintainer_file, number): if not areas: continue - all_areas.update(areas) is_instance = False sorted_areas = sorted(areas, key=lambda x: 'Platform' in x.name, reverse=True) for area in sorted_areas: From 1a92761d4f470fb058998cd0e83dbff558c75ae7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 12:23:24 -0400 Subject: [PATCH 32/38] handle manifest areas Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index dfabda04980..9d4d3e5a84c 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -144,14 +144,24 @@ def process_pr(gh, maintainer_file, number): return for changed_file in fn: + num_files += 1 log(f"file: {changed_file.filename}") areas = [] if changed_file.filename in ['west.yml','submanifests/optional.yaml']: - continue - - areas = maintainer_file.path2areas(changed_file.filename) + if args.areas and Path(args.areas).is_file(): + with open(args.areas, "r") as f: + areas = json.load(f) + for _area in areas: + area_match = maintainer_file.name2areas(_area) + if area_match: + areas.extend(area_match) + else: + log(f"Manifest changes detected but no --areas file specified, skipping...") + continue + else: + areas = maintainer_file.path2areas(changed_file.filename) if not areas: continue From 18489ea88a1b927154b47216de8251fe48dae4f3 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 12:25:20 -0400 Subject: [PATCH 33/38] handle areas Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index 13f2010065e..b8ec8bc5ec3 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -74,6 +74,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | - cat ./pr/manifest_areas.json + if [ -f "./pr/manifest_areas.json" ]; then + ARGS-"--areas ./pr/manifest_areas.json" + else + ARGS="" + fi python3 scripts/set_assignees.py -P ${{ env.PR_NUM }} -M MAINTAINERS.yml -v \ - --repo ${{ github.event.repository.name }} + --repo ${{ github.event.repository.name }} ${ARGS} From 8ac8d6bdadb7b0e452682930847f46ebd6840753 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 12:50:54 -0400 Subject: [PATCH 34/38] fix arg Signed-off-by: Anas Nashif --- .github/workflows/assigner-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/assigner-workflow.yml b/.github/workflows/assigner-workflow.yml index b8ec8bc5ec3..e6025835b41 100644 --- a/.github/workflows/assigner-workflow.yml +++ b/.github/workflows/assigner-workflow.yml @@ -75,7 +75,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.ZB_PR_ASSIGNER_GITHUB_TOKEN }} run: | if [ -f "./pr/manifest_areas.json" ]; then - ARGS-"--areas ./pr/manifest_areas.json" + ARGS="--areas ./pr/manifest_areas.json" else ARGS="" fi From 8a370b71830a910f72bfcf6fb4fff308b51b9b36 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 5 Sep 2025 14:09:32 -0400 Subject: [PATCH 35/38] parsed Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 9d4d3e5a84c..913067f7b45 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -152,8 +152,8 @@ def process_pr(gh, maintainer_file, number): if changed_file.filename in ['west.yml','submanifests/optional.yaml']: if args.areas and Path(args.areas).is_file(): with open(args.areas, "r") as f: - areas = json.load(f) - for _area in areas: + parsed_areas = json.load(f) + for _area in parsed_areas: area_match = maintainer_file.name2areas(_area) if area_match: areas.extend(area_match) From de2992a3d8a3e15aba437a7f43fd3f1b7ce659ee Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 07:47:28 -0400 Subject: [PATCH 36/38] dummy change Signed-off-by: Anas Nashif --- subsys/tracing/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/tracing/Kconfig b/subsys/tracing/Kconfig index 5e3d349345b..a61f8b83784 100644 --- a/subsys/tracing/Kconfig +++ b/subsys/tracing/Kconfig @@ -1,4 +1,5 @@ # Debug configuration options +# dummy # Copyright (c) 2015 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 From 4c377c0f4b266c7d8ffa50e61ccf3df0a12d0970 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 07:56:51 -0400 Subject: [PATCH 37/38] change cmsis Signed-off-by: Anas Nashif --- west.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/west.yml b/west.yml index 831aa11ce7b..d4134ead82f 100644 --- a/west.yml +++ b/west.yml @@ -121,6 +121,7 @@ manifest: path: modules/hal/cmsis groups: - hal + - foo - name: cmsis-dsp revision: 97512610ec92058f0119450b9e743eeb7e95b5c8 path: modules/lib/cmsis-dsp From ea3c74eff88034f0ac02739d9b0cf60d1ab728f8 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 2 Sep 2025 08:07:50 -0400 Subject: [PATCH 38/38] another change Signed-off-by: Anas Nashif --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d4134ead82f..5f85be5b864 100644 --- a/west.yml +++ b/west.yml @@ -126,7 +126,7 @@ manifest: revision: 97512610ec92058f0119450b9e743eeb7e95b5c8 path: modules/lib/cmsis-dsp - name: cmsis-nn - revision: e9328d612ea3ea7d0d210d3ac16ea8667c01abdd + revision: f9328d612ea3ea7d0d210d3ac16ea8667c01abdd path: modules/lib/cmsis-nn - name: cmsis_6 repo-path: CMSIS_6