Add `git node staging` command
Add a new git node staging command that automates cherry-picking commits into staging branches.
It works by cherry-picking all commits that have no conflicts and stopping when finding commits that have conflicts so that the releaser can either manually fix that conflict to continue or skip.
Usage:
Fetches a commit list using branch-diff and automatically cherry-picks / skips commits based on whether or not they land cleanly:
git node staging
By default the script will add backport-request labels to any skip commit, in order to run in a "dry-run" mode, avoiding the GH cli interactions, you can use the skipGH flag, e.g:
git node staging --skipGH
After fixing up manual conflicts using git cherry-pick --continue the releaser can resume the cherry-pick queue:
git node staging --continue
Similarly, after manually skipping a commit using git cherry-pick --skip the releaser can resume the cherry-pick queue using:
git node staging --skip
If you want to run the script and automatically skip any commit that is unable to land cleanly you can use the --autoSkip flag:
git node staging --autoSkip
Sets a custom reporter at the end of the automated operation:
git node staging --reporter=json
Limits to 10 the number of commits to be cherry-picked:
git node staging --pagination=10
Automates the backport request message, this won't run any of the branch-diff or cherry-pick routines. Useful for when you removed a faulty commit from the branch and want to signal to PR author and collaborators that commit now needs backporting, just use its PR#:
git node staging --backport=12345
More:
The automate cherry-pick logic also includes local persistency of the ongoing commit list, in case a fatal error happens during the command execution, it's possible to resume after cleaning up the git repo state by running git node staging again.
Report
A report is generated at the end of operations listing information on the commits that were successfully cherry picked and commits that failed to be cherry-picked due to conflicts.
[!IMPORTANT] Below is a short example of how these reports look like. The following report was generated for an operation that was limited using
--pagination=10
Cherry-pick Report
6 successfully cherry-picked commits:
-
a21be0294d0build,win: enable pch for clang-clwindows,build,v8 engine,tools,needs-ci,gyp -
c7f82ec9780doc: fix the return type of outgoingMessage.setHeaders()http,doc,author ready -
d8c552a060bdoc: edit onboarding guide to clarify when mailmap addition is neededdoc,author ready,commit-queue-squash -
a5590083cddnode-api: add napi_create_buffer_from_arraybuffer methodbuffer,c++,node-api,needs-ci,commit-queue-squash -
6c836aa97eemeta: bump step-security/harden-runner from 2.9.1 to 2.10.1meta,dependencies,github_actions -
47b6c6748bameta: bump github/codeql-action from 3.26.6 to 3.26.10meta,dependencies,github_actions
4 commits that failed to cherry-pick:
-
71785889c89lib: prefer logical assignmentlib / src,author ready,needs-ci -
4988bb549e7tools: enforce ordering of error codes inerrors.mdtools,errors,author ready,dont-land-on-v18.x,dont-land-on-v20.x -
9f9069d3130fs: fix linter issuefs,fast-track,author ready,needs-ci,commit-queue-squash -
90f56dbad9cmodule: throw ERR_NO_TYPESCRIPT when compiled without amaroutil,module,errors,author ready,needs-ci,strip-types