Recipes
Ready-to-copy workflows that combine bb with jq and shell. Set the required environment variables and read the caveats before running a script. Some examples depend on a companion script from the same page.
For JSON, pagination and CI setup, see the Scripting & Automation guide and the CI/CD Integration guide.
Available recipes
Section titled “Available recipes”Auto-merge when CI is greenRead all status pages, require named CI checks and recheck the head before merging.
Bulk reviewer assignmentAssign a fixed list of reviewers across many open pull requests (team rotations, onboarding).
Fork synchronizationFetch upstream, rebase your fork, and push the result for fork-based contribution flows.
Reporting & analytics with jqCount PRs per state, sum diff sizes, group by author, and export to CSV.
Retry wrapper for transient failuresA shell wrapper that retries bb invocations with exponential backoff for persistent flakes.
Conventions used in these recipes
Section titled “Conventions used in these recipes”- Authenticate first with
bb auth login, or setBB_USERNAMEto your Atlassian account email andBB_API_TOKENto your API token. - Set
WORKSPACEandREPOin the environment. Scripts either require them or supply example defaults. - Use Bash and external jq. Make saved scripts executable with
chmod +x script-name.sh. - List commands default to
--limit 25. Pass--allwherever a recipe has to see every result; theShowing 25 pull requests. Use --limit <n> or --all to see more.hint is printed with table output only, never under--json. - The CLI already retries HTTP 429, 502, 503 and 504 up to 3 times with exponential backoff. It also retries
ECONNRESET,ETIMEDOUT,ECONNABORTED,EAI_AGAINandEPIPEon GET, HEAD and OPTIONS. Nothing else is retried; a 500 is not, and neither isENOTFOUNDor a TLS failure. The retry wrapper recipe is for failures that persist past that. --jqJSON-encodes its output: strings come back with quotes around them. Add--raw-output(or pipe--jsonto externaljq -r) when you need a raw string for the shell. See the JSON Output reference for the envelope structure of list-style commands.