Skip to main content

Module await_pr

Module await_pr 

Source
Expand description

gw await command - Watch a specific PR to completion, then clean up.

await is the closing bookend of the workflow. Its irreducible job is to watch the PR until it reaches a terminal state (merged or closed); the CI wait and the post-merge cleanup are adjacent steps composed on top, each toggleable by a flag.

The PR is identified by number, not by the current branch. This keeps a background watcher bound to one PR even if you switch branches (e.g. while working a stacked PR), and lets the post-merge cleanup target the PR’s own head branch rather than whatever happens to be checked out.

Phases:

  1. Wait for CI — gh pr checks --watch (skip with --no-wait)
  2. Watch for merge — poll the PR state every --interval seconds
  3. On merge — notify, then gw cleanup <head branch> (skip with --no-cleanup)

Environment-specific behavior stays in the user’s dotfiles, not the CLI:

  • --open opens the URL via GW_OPEN_URL_CMD/OPEN_URL_CMD (see gw open)
  • the merge notification is delegated to GW_NOTIFY_CMD (called as $GW_NOTIFY_CMD "<message>"), e.g. a script wrapping macOS osascript.

Functions§

run
Execute the await command for a specific PR number