casaroli opened a new pull request, #3881:
URL: https://github.com/apache/nuttx-apps/pull/3881

   ## Summary
   
   When a `Depends-On:` PR is merged, its commits are already in master. Build 
still cherry-picks the PR head again. The cherry-pick is empty or conflicts, 
and `Fetch-Source` fails with `cherry_pick_conflict`. Today the author must 
remove the line and start CI again each time a dependency merges.
   
   This PR reads the state of each dependency with the GitHub API:
   
   - merged, and its merge commit is in the checkout: CI skips it and says so 
in the log;
   - closed without merge: CI does not apply it and fails with 
`::error::Dependency <dep> is closed without merge; remove it from depends-on 
or reopen it.`;
   - all other dependencies (open, merged into a different branch, merge commit 
not in the checkout, state not readable): CI applies them as today.
   
   `applied.tsv` and `result.json` mark a skipped dependency. A failure report 
for a closed dependency gets the error code `dependency_closed` and marks that 
dependency. The comment shows "(already merged, skipped)", or "❌ **closed 
without merge**" with the reason for the failure.
   
   nuttx carries a copy of these workflows; the same change goes there in its 
own PR, together with the documentation in `Documentation/testing/nuttx-ci.rst`.
   
   ## Impact
   
   CI only. Behaviour change: a `Depends-On:` PR that is closed without merge 
now fails `Fetch-Source`. On master, CI applied such a PR silently and the 
build continued. A PR body can now keep a `Depends-On:` line after the 
dependency merges. One extra API call for each declared dependency, with the 
workflow `GITHUB_TOKEN`. Nothing changes for PRs without `Depends-On:`, or for 
open dependencies.
   
   ## Testing
   
   I ran the "Apply depends-on PRs" step script of this `build.yml` on my 
machine against real PRs (apache/nuttx#20802 is merged, apache/nuttx#20783 is 
closed without merge, #3878 is open).
   
   | Body | master | this PR |
   |---|---|---|
   | `[apache/nuttx/pull/20802 apache/nuttx-apps/pull/3878]` | fails, 
`cherry_pick_conflict` | skips 20802, applies #3878, exit 0 |
   | `[apache/nuttx/pull/20802 apache/nuttx/pull/20783 
apache/nuttx-apps/pull/3878]` | fails, `cherry_pick_conflict` | skips 20802, 
fails on 20783: "closed without merge; remove it from depends-on or reopen it" |
   
   I also ran the github-script of `depends-on-comment.yml` with node and a 
fake API, for both reports: it shows the notes and the reason above. 
`tools/checkpatch.sh -c -u -m -g` passes.
   
   The `depends-on` line below is a test of this PR: both PRs are merged, so 
the Fetch-Source job of this PR must skip them (and read the state of a PR of 
the other repository with the workflow token).
   
   depends-on: [apache/nuttx/pull/20802 apache/nuttx-apps/pull/3868]
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to