Skip to content

upstream-sync

Watches the upstreams a repository mirrors and opens one update PR per upstream that moved.

Everything here is driven by upstreams.json and the handler commands it names, so any repository that vendors upstream code can use it: through the sync-upstreams bin, or the reusable sync-upstreams.yml workflow.

Interface Description
CommandResult What a command printed and how it exited.
GitUpstreamEntry An upstream followed on a GitHub branch or tag, pinned to a commit.
NpmUpstreamEntry An upstream followed as an npm package’s dist-tag, pinned to a version.
SyncDependencies Everything the sync does to the outside world, so a test can stand a fixture in for it.
SyncPlan The PR an upstream move asks for.
SyncResult What happened to one entry.
SyncUpstreamsOptions What syncUpstreams syncs, and how.
UpstreamsConfig The content of upstreams.json.
UpstreamStatus What one comparison of an entry with its upstream found.
Function Description
buildPrBody Writes the PR body.
compareWithUpstream Compares one entry with its upstream.
parseUpstreamsConfig Parses and validates an upstreams.json.
planSync Plans the PR a moved upstream asks for.
syncUpstreams Checks every entry, and opens or updates one PR per moved upstream. A handler or verify failure still opens the PR, as a draft with the failure in its body, so a breaking upstream change is seen rather than skipped. An error in the sync itself, such as a failed API call, is reported in the entry’s result and the next entry still runs.
writePin Records head as the entry’s pin in upstreams.json, unless the handler already moved it, keeping the file’s key order and formatting.
Type Description
UpstreamEntry One upstream that upstreams.json lists: a git one or an npm one.