The docs say that a deploy preview will show you what the site will look like if the proposed changes were merged. But, the deploy preview does not change when changes happen on the production branch, even if the deploy preview is re-triggered manually or with additional commits on the PR branch. It makes me think the deploy preview is not showing the result of a merge at all, as the docs claim.
The definitions page says
Deploy Preview : a deploy generated from a pull request or merge request, building the site as it would be if the proposed changes were merged
but this doesn’t seem to be true. In fact, a support agent told me:
The deploy preview shows what’s built when we build the deploy preview. When a PR is created, that’s the deploy preview. The merge will be the production build. Definitions can be found here.
The problem I had went like this
- create a commit in the production branch that causes builds to fail (for example, a syntax error in netlify.toml)
- create a PR (PR #1) building off of the production branch - modify some other code, not the netlify.toml that’s broken
- notice the deploy preview fails on PR #1, due to the error in netlify.toml
- create a separate PR (#2) fixing the netlify.toml error
- Merge PR #2 into the auto deploy branch. The production branch can now successfully deploy.
- Re-run the deploy preview for PR #1 - see the same failure as before, as if netlify.toml hasn’t been fixed in the production branch
- Add another commit to PR #1, which does not fix the netlify.toml but does something else
- expectation: the code in the PR has changed, and the production branch has changed to be able to build, so the deploy preview should be able to run successfully this time
- actual behavior: the deploy preview fails again, with the error message about your netlify.toml
The only way to get a successful deploy preview once you’re in this state is to merge the production branch into your PR #1 branch.
I’d expect the deploy preview to show me a preview of what will happen after a merge, not simply whatever is on the PR branch exactly, ignoring what’s on the production branch.