in sync/upstream.py [0:0]
def update_github(self) -> None:
if self.pr:
state = env.gh_wpt.pull_state(self.pr)
if not len(self.gecko_commits):
env.gh_wpt.close_pull(self.pr)
elif state == "closed":
pr = env.gh_wpt.get_pull(self.pr)
if not pr.merged:
env.gh_wpt.reopen_pull(self.pr)
else:
# If all the local commits are represented upstream, everything is
# fine and close out the sync. Otherwise we have a problem.
if len(self.upstreamed_gecko_commits) == len(self.gecko_commits):
if self.status not in ("wpt-merged", "complete"):
env.bz.comment(self.bug, "Upstream PR merged")
self.finish()
else:
# It's unclear what to do in this case, so mark the sync for manual
# fixup
self.error = ("Upstream PR merged, " # type: ignore
"but additional commits added after merge")
return
if not len(self.gecko_commits):
return
if not len(self.upstreamed_gecko_commits):
return
if self.push_required():
self.push_commits()
if not self.pr:
self.create_pr()
self.set_landed_status()