def update_pr()

in sync/downstream.py [0:0]


def update_pr(git_gecko: Repo,
              git_wpt: Repo,
              sync: DownstreamSync,
              action: str,
              merge_sha: str,
              base_sha: str,
              merged_by: str | None = None,
              ) -> None:
    try:
        if action == "closed" and not merge_sha:
            sync.pr_status = "closed"  # type: ignore
            if sync.bug:
                env.bz.set_status(sync.bug, "RESOLVED", "INVALID")
            sync.finish()
        elif action == "closed":
            # We are storing the wpt base as a reference
            sync.data["wpt-base"] = base_sha
            sync.next_try_push()
        elif action == "reopened" or action == "open":
            sync.status = "open"  # type: ignore
            sync.pr_status = "open"  # type: ignore
            sync.next_try_push()
            assert sync.bug is not None
            if sync.bug:
                status = env.bz.get_status(sync.bug)
                if status is not None and status[0] == "RESOLVED":
                    env.bz.set_status(sync.bug, "REOPENED")
        sync.update_github_check()
    except Exception as e:
        sync.error = e
        raise