Pull Request Reviews provide a comparison of a Site monitored in Calibre and a preview deployment. You can use Pull Request reviews to compare between a branch and your live Site, before changes are merged.
Each Pull Request Review tests preview deployments using the same conditions as your Site. This includes the same test location, authentication, headers, cookies, Test Profiles, and Pages. You can override authentication, headers, and cookies if needed.
Each deployment must have a unique hostname (e.g.: my-preview-url-123.example.com) in order to use Pull Request reviews.
Create a Pull Request Review#
Read Sites, Start Pull Request Reviews
# This command will:
# - Block until performance tests have been completed (`--waitForResult`)
# - Return a failure if this PR fails specified performance budgets (`--failOnUnmetBudget`)
# - Write `comparison_report.md`, a markdown formatted Performance report
calibre site create-pull-request-review \
--site="calibre" \
--title="(fix): Reduce bundle size" \
--url="https://my-pr-123.example.com" \
--branch="$(git rev-parse --abbrev-ref HEAD)" \
--sha="$(git rev-parse HEAD)" \
--waitForResult \
--failOnUnmetBudget \
--markdown > comparison_report.md#!/usr/bin/env node
import { PullRequestReview } from 'calibre'
const createPRReview = async () => {
// Required
const url = 'https://my-pr-123.example.com'
const title = '(fix): Reduce bundle size'
const branch = 'fix/reduce-bundle-size'
const sha = '9ff192958fe518f0bb06b2e25ab5836f52353d8e'
const site = 'my-calibre-site-slug'
// Create the PR Review
const { uuid } = await PullRequestReview.create({
url,
title,
branch,
sha,
site
})
console.log('Pull Request Review queued:', branch)
// Wait for tests to run
const results = await PullRequestReview.waitForReviewCompletion(site, branch)
// Output the formatted JSON response
console.log(JSON.stringify(results, null, 2))
}
createPRReview()You can read CLI documentation for calibre site create-pull-request-review here.
View an existing Pull Request Review#
Read Sites
# Pro tip: Add the --markdown flag for Markdown,
# or --json flag for JSON output
calibre site pull-request-review \
--site="my-calibre-site-slug" \
--branch="fix/reduce-bundle-size"#!/usr/bin/env node
import { PullRequestReview } from 'calibre'
const getPRReview = async () => {
// Required
const site = 'my-calibre-site-slug'
const branch = 'fix/reduce-bundle-size'
// Fetch the Pull Request Review
const results = await PullRequestReview.getPRReviewByBranch(site, branch)
// Output the formatted JSON response
console.log(JSON.stringify(results, null, 2))
}
getPRReview()You can read CLI documentation for calibre site pull-request-review here.
List Pull Request Reviews#
Read Sites
calibre site pull-request-reviews --site <site>#!/usr/bin/env node
import { PullRequestReview } from 'calibre'
const getPRReviews = async () => {
// Required
const site = 'my-calibre-site-slug'
// Fetch a list of Pull Request Reviews
const results = await PullRequestReview.list(site)
// Output the formatted JSON response
console.log(JSON.stringify(results, null, 2))
}
getPRReviews()Example response#
TITLE | BRANCH | SHA | STATUS | CREATED
[UI] Add new dropdowns | feat/new-dropdowns | 8de2a10… | completed | 6:15PM 6-Sep-2023
[Perf] Add lightbox alternative | perf/remove-lightbox | 05ae42a… | completed | 3:52PM 25-Aug-2023
[UI] Migrate menus from Reach to Radix… | migrate-from-reach-menu | 241ccbb… | completed | 4:48PM 22-Aug-2023
[Docs] Update FAQs | docs/update-faqs | 78f9a44… | completed | 5:31PM 15-Aug-2023[
{
"title": "[UI] Add new dropdowns",
"status": "completed",
"branch": "feat/new-dropdowns",
"sha": "8de2e10a4a1f7fe46daf5532095842bda6491ea1",
"createdAt": "2023-09-06T08:15:58Z"
},
{
"title": "[Perf] Add lightbox alternative",
"status": "completed",
"branch": "perf/remove-lightbox",
"sha": "05ae42a94a0cf860454b3226b4f3f016ed32430f",
"createdAt": "2023-08-25T05:52:37Z"
},
{
"title": "[UI] Migrate menus from Reach to Radix UI",
"status": "completed",
"branch": "migrate-from-reach-menu",
"sha": "241ecbb0d2c396c9413adb816fa3ca212eff00da",
"createdAt": "2023-08-22T06:48:03Z"
},
{
"title": "[Docs] Update FAQs",
"status": "completed",
"branch": "docs/update-faqs",
"sha": "78a9e442d4f952b612e2d9627b43e61cd5c7e044",
"createdAt": "2023-08-15T07:31:48Z"
}
]You can read CLI documentation for calibre site pull-request-reviews here.