Pull Request Review Configuration


Advanced configuration for Pull Request Reviews can be set using a .calibre/config.yml file. This configuration file allows you to customize authentication, headers, cookies, and branch-specific settings.

Configuration file structure

There are two top-level properties you must specify:

  • version: The current version is 2
  • pullRequestReviews: Options for Pull Request Reviews

Version

There are two versions of the Calibre configuration file.

  • Version 1: Single configuration block (Deprecated)
  • Version 2: Supports multiples blocks of configuration which can be used for branch specific configuration.

You can set the version by specifying the version number as the value of the version key:

1version: 2
2pullRequestReviews:

Authentication configuration

Calibre will automatically copy authentication settings from each Site to each Pull Request Review test. The authentication URL will be updated to use the same host as the pull request deployment.

If you require specific authentication details for Pull Request Reviews, you can set them using config.yml. This is helpful when your Pull Request environment has different authentication than the main Site.

Define authentication settings

The following configuration will be used for authentication:

1version: 2
2pullRequestReviews:
3 - authentication:
4 url: https://different-domain.com/login
5 username: user@email.com
6 password: mysecretpassword
7 formSelector: form
8 usernameSelector: input[name=email]
9 passwordSelector: input[type=password]
1version: 1
2pullRequestReviews:
3 authentication:
4 url: https://different-domain.com/login
5 username: user@email.com
6 password: mysecretpassword
7 formSelector: form
8 usernameSelector: input[name=email]
9 passwordSelector: input[type=password]

Password only settings

Providers like Netlify and Vercel have the option to password protect preview deployments. By omitting the authentication URL and only setting the password fields, the Calibre Agent will login to the deployment URL with a password before each Snapshot:

1version: 2
2pullRequestReviews:
3 - authentication:
4 password: mysecretpassword
5 passwordSelector: input[type=password]
1version: 1
2pullRequestReviews:
3 authentication:
4 password: mysecretpassword
5 passwordSelector: input[type=password]

Headers and cookies

You can specify headers and cookies for each Pull Request Review test.

Caution

Test Profiles can override cookies and headers set in Pull Request Review configuration. Calibre applies cookies and headers in the following order: Test Profile cookies and headers, Cookies and headers set in .calibre/config.yml, then Test Agent cookies and headers.

1version: 2
2pullRequestReviews:
3 # Headers
4 - headers:
5 - name: X-Calibre-Test
6 value: Pull Request
7 - name: User-Agent
8 value: Calibre
9
10 # Cookies
11 - cookies:
12 - name: seen-cookie-notice
13 value: true
14 - name: uid
15 value: 1
16 domain: calibreapp.com
17 path: /
18 secure: true
19 httpOnly: true
20
21 # Specify headers and cookies for branches prefixed with `stage-`
22 - headers:
23 - name: X-Environment
24 value: staging
25 cookies:
26 - name: staging-cookie
27 value: true
28 branches:
29 - stage-*

Branch specific configuration

You can specify configuration blocks for different branches using positive and negative patterns.

The order branch patterns are defined matters. The last matching pattern will determine if the branch is included or excluded.

Disable authentication for a preview branch

The following configuration will apply authentication settings for all preview- branches except for preview-public as the last matching pattern for this branch does not require authentication.

1version: 2
2pullRequestReviews:
3 - branches:
4 - preview-*
5 authentication:
6 password: mysecretpassword
7 formSelector: form
8 passwordSelector: input[type=password]
9 required: true
10 - branches:
11 - preview-public
12 authentication:
13 required: false

Complete configuration example

Here's a comprehensive example showing all available configuration options:

1version: 2
2pullRequestReviews:
3 # Default configuration for all branches
4 - authentication:
5 url: https://auth.example.com/login
6 username: test@example.com
7 password: secretpassword
8 formSelector: form.login
9 usernameSelector: input[name=email]
10 passwordSelector: input[type=password]
11 required: true
12 headers:
13 - name: X-Environment
14 value: preview
15 - name: Authorization
16 value: Bearer token123
17 cookies:
18 - name: session-id
19 value: abc123
20 domain: example.com
21 path: /
22 secure: true
23 httpOnly: true
24
25 # Configuration for staging branches
26 - branches:
27 - staging/*
28 - stage-*
29 authentication:
30 password: stagingpassword
31 passwordSelector: input[type=password]
32 headers:
33 - name: X-Environment
34 value: staging
35 cookies:
36 - name: staging-mode
37 value: true
38
39 # Configuration for public preview branches (no auth required)
40 - branches:
41 - public-*
42 authentication:
43 required: false
44 headers:
45 - name: X-Environment
46 value: public-preview