land-ticket
Land ticket
The step after implement and code-review: a ticket's PR is open and reviewed, and this lands it. The argument is the PR number; without one, use the PR bound to this session, or the open PR for the current branch.
1. Gate
Gate on the PR's merge state and on the check run for its current head, in that order.
Read the merge state through the tracker: clean, behind, or conflicting. A branch that is merely behind the base — no conflicts — is brought up to date here, through the tracker's update-branch operation, and the gate continues on the new head:
# gh, as an example of the update-branch operation
gh pr update-branch <PR>
Then wait on the check run whose head is the PR's current head: read the head SHA, list the runs for the branch, pick the one whose head matches, and watch that run to its conclusion. The head, not the PR's aggregate — a watch on the PR's checks reports the previous head's finished run and returns before the new one starts.