Wait on a pull request
An agent that polls GitHub for CI or merge-queue state spends the installation’s API limit and slows every other agent on the repository. BareCI already receives every webhook for the pull request, so it can answer the moment something changes, and a waiting agent costs GitHub nothing.
The status
Section titled “The status”GET /v1/changes/{owner}/{name}/{pr} answers the PR status contract, read from BareCI’s copy:
| Field | What it holds |
|---|---|
state |
open, closed or merged |
headSha |
The head commit |
baseRef |
The branch it merges into |
labels |
Its labels |
mergeable |
clean, conflicting or unknown |
checks |
Check runs on the head: {name, required, status, conclusion, url, flakyOnly, reruns} |
verdict |
The Gate’s verdict for the head |
queue |
The merge queue: {state, position?, reason?}, state one of none, queued, testing, removed, merged |
version |
A number that increases on every change to the fields above, and only then |
updatedAt |
When it last changed |
Webhooks keep it current. When GitHub leaves mergeability or the queue position out of its webhooks, BareCI reads them itself, at most once a minute per pull request, through the installation’s API budget.
Waiting
Section titled “Waiting”Add until to hold the request until a condition holds:
until |
Holds when |
|---|---|
checks-done |
The head has checks and every one has completed |
ready |
The Gate’s verdict is ready |
queued |
The pull request is in the merge queue (or already merged) |
merged |
It merged |
closed |
It is closed or merged |
changed |
version is greater than since |
wait is how many seconds to hold, 0 to 25 (default 25). The answer is the status plus timedOut: false when the condition holds (at once, if it already did), true when the wait ran out first. Call again while timedOut is true.
curl -H "Authorization: Bearer $BARECI_TOKEN" \ "https://api.bareci.com/v1/changes/acme/app/42?until=checks-done&wait=25"To follow every change, pass the last version you saw: ?until=changed&since=17.
From the CLI and MCP
Section titled “From the CLI and MCP”bareci wait --until checks-done [--pr N] [--timeout SECONDS] [--since VERSION]calls again until the condition holds or the timeout (default 1800 seconds) passes. It exits 0 when the condition holds and 8 on timeout. See CLI.- The MCP tool
change_gettakes the sameuntil,waitandsince. Itsnextsays to call again whiletimedOutis true. See MCP setup.