Skip to content

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.

  • Authenticate first with bb auth login, or set BB_USERNAME to your Atlassian account email and BB_API_TOKEN to your API token.
  • Set WORKSPACE and REPO in 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 --all wherever a recipe has to see every result; the Showing 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_AGAIN and EPIPE on GET, HEAD and OPTIONS. Nothing else is retried; a 500 is not, and neither is ENOTFOUND or a TLS failure. The retry wrapper recipe is for failures that persist past that.
  • --jq JSON-encodes its output: strings come back with quotes around them. Add --raw-output (or pipe --json to external jq -r) when you need a raw string for the shell. See the JSON Output reference for the envelope structure of list-style commands.