Pull Request Previews
Simply reviewing code in a pull request can sometimes be insufficient — you often want to inspect and review the changes functionally and visually before merging them. Render makes this effortless with Pull Request Previews.
PR previews are disabled by default and can be enabled for any static site or web service (including server-side web apps). You can do this on the Pull Requests tab or in the Settings section for your service.PR Previews only create one instance of a single service for each pull request. If you'd like to create a high fidelity copy of your entire production environment (including databases) for every pull request, use Preview Environments instead.
Once enabled, every new PR opened on the base branch for your service will automatically create a new instance of the service based on the code in the PR. This instance will be listed under the Pull Requests tab for your service.
Every PR instance gets a unique
onrender.comURL served over HTTP/2 and full TLS. You can use this URL to review the PR as long as it is open.
You can detect a PR preview in your app by looking for the environment variable
IS_PULL_REQUEST. It is set to
truefor PR previews and
falsefor everything else.
Every push to the pull request branch automatically builds and deploys the latest commit for that branch. This way your PR URL always reflects the latest changes introduced in the pull request. You can fine-tune this behavior by defining the Root Directory or specifing Build Filters.
PR instances copy all their settings over from the base service when they are first created. This includes environment variables including database connection information.Make sure to change environment variables on your PR instance if you want it to use a staging or test database.
All PR instances are automatically deleted when the underlying PR is merged or closed.
Any changes made to the base service after the PR instance is created will not apply to the PR instance. This helps you test both code and environment changes in the PR without changing production.
- PR Previews are billed at the same rate as your base service, and are always prorated by the second.
- If your base service is a free static site, all its PR previews will be free as well.
- If your base service costs $7 per month, PR preview instances based on it will cost the same. For example, if you create a PR for a Node app that costs $7 per month, and the PR instance is up for 2 weeks, it will cost a total of $3.50.