ci: Support pull request dependencies via Depends-On. - #3690
Open
zhangning21 wants to merge 1 commit into
Open
Conversation
Allow pull requests targeting master to declare same- and cross-repository dependencies. Parse declarations with a tested Python helper, apply exact dependency commits before the existing build matrix, and rerun heavy CI only when an edited description changes the dependency state. Keep fork builds read-only and use a trusted workflow_run to validate artifacts and post per-build dependency results. Keep the apps workflow consistent with the implementation already merged in apache/nuttx. Assisted-by: Kiro:gpt-5.6-sol Signed-off-by: zhangning21 <zhangning21@xiaomi.com>
xiaoxiang781216
approved these changes
Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the
nuttx-appsside of the pull-request dependency support already merged in apache/nuttx#19075. This keeps the two repositories' Build workflows consistent and lets an apps PR test exact same- or cross-repository companion PR heads before either change is merged.Why this is needed
NuttX and nuttx-apps are built together. For a normal PR,
Fetch-Sourcechecks out the target branch from the changed repository and the corresponding branch from the other repository. A feature that must change both repositories can therefore fail in both PRs because neither target branch contains the companion change yet. This feature lets CI test the exact combined changes before either PR is merged. It also supports a PR depending on another PR in the same repository.Implementation
depends_on.pyparser and 40 regression tests used by NuttX.Fetch-Source, before the existing matrix.workflow_runwith narrowly scopedactions: readandpull-requests: writepermissions.The trusted
depends-on-comment.ymlworkflow becomes active after it is merged into the repository's default branch, because GitHub only triggers a newly addedworkflow_runworkflow when that workflow file exists on the default branch.The follow-up comment reports one of three outcomes:
ok: each dependency PR and its fetched head SHA, abbreviated in the comment;invalid: a marker was found but no valid dependency could be parsed, so no dependency is applied and CI continues with normal source selection;failed: a valid dependency could not be applied, with a fixed diagnostic reason. This causesFetch-Sourceto fail.The accepted declaration forms, result comments, release behavior, and limitations are already documented in NuttX's central CI documentation by apache/nuttx#19075.
Usage
A PR targeting
mastermay declare one dependency per line:or one inline list:
The marker is case-insensitive. Duplicate references are applied once in first-seen order. Invalid declarations do not apply a dependency and do not fail Build; a valid dependency that cannot be fetched or cherry-picked fails
Fetch-Source.Impact and security
Depends-On:retain the existing source selection and build-matrix behavior; every PR gains only the shortChangesgate, and Build additionally listens for description edits.contents: read; it does not receive write permission or secrets.eval, shell parsing pipeline, or third-party package.workflow_rundoes not check out or execute fork code. Before commenting it validates the report schema, enforces the repository allow-list and dependency-number constraints, rejects duplicate entries, requires full dependency head SHAs forokresults, and verifies run/current-head binding.pull-requests: writeonly to post the validated result comment, matching the permission model already merged and exercised inapache/nuttx. Please confirm that the same repository policy is enabled forapache/nuttx-apps; no other write permission is requested.Fetch-Source.Changesgate and skipsFetch-Sourceand the matrix.Testing
Local validation:
py_compile: passed.git diff --check: passed.Lintpassed at the pure feature commit (run 30734995071) and the E2E commit (run 30735668914).Real GitHub Actions E2E was run in the public
zhn-test/nuttx-appsmirror with fresh dependency PRs and a trusted default-branch comment workflow. The staging workflow mapsapache/nuttx,apache/nuttx-apps, andmastertozhn-test/nuttx,zhn-test/nuttx-apps, and a master-equivalent test base; the feature logic is otherwise the same. The four E2E-only matrix gates and all test repository/base substitutions are excluded from the upstream commit:invalid; Build continued and warning was postedFetch-Sourcefailed and a fixed-reason comment was postedx86_64-01build passedinvalid; warning postedChangesran; Fetch and downstream jobs skippeddepends_on.py; log confirms the base parser was used before Fetch/apply/comment succeededThe staging scenario branches skipped the heavy matrix after
Fetch-Sourceto avoid duplicating runner cost. Before that E2E-only gate was added, feature run 30734995149 at the pure feature commit verifiedChanges,Fetch-Source, and all four architecture-selection jobs successfully. Its overall result iscancelledbecause it was superseded after those jobs passed to stop the remaining heavy matrix; it is not presented as a complete matrix pass. The upstream PR's normal CI remains responsible for the full apps build matrix.Intentional limitations