[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Discussions](/c/community/4)

# Does Vercel's auto preview build + deploys use the head PR commit or the speculative merge commit?

76 views · 3 likes · 6 posts


Sangeeth Sudheer (@runofthemillgeek) · 2025-12-29

I’m realizing from the following links:

* https://github.com/actions/checkout/issues/504
* https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request

On `pull_request` workflow triggers, `actions/checkout` uses the speculative mere commit of PR head → base branch head instead of the *actual* PR head itself. I kinda get why that was decided and in some ways, makes things easy and in some ways, hard.

But I wanted to understand how Vercel auto preview build + deploys behave. I was trying to move to a more GitHub Actions-centric workflow to do all builds + deploys (IDK why this is so difficult to do with Vercel) so was trying out manually building + deploying to Vercel from GitHub Actions using `vercel` CLI. I observed the following:

![CleanShot_2025-12-30T02.15.28_Google Chrome-experiment-ci-driven-vercel-deploys – Deployment Overview@2x|690x432](upload://g2HYh7U0MCC0hUU57BwMKv7iPES.jpeg)

where right is after creating vercel project, where the initial commit was deployed to prod, where the links + commit info is all correct. But when I did `vercel build` + `vercel deploy` from GitHub workflow, I saw weird stuff which can now be explained because of `pull_request` behavior.

So, are Vercel auto deploys then always picking the head commit of a PR branch and is that why the branch/commit info is correct? If yes, does this mean that we cannot rely on `pull_request` events at all when working with Vercel GitHub integration since the results would be different for jobs running on Vercel vs GitHub Actions?


Amy Egan (@amyegan) · 2026-01-06 · ♥ 1

Vercel’s auto preview deployments use the actual PR head commit , not the speculative merge commit that GitHub Actions uses by default.

If you want your GitHub Actions workflow to match Vercel’s behavior, you can explicitly checkout the PR head commit in your workflow:
  ```
  - uses: actions/checkout@v4
    with:
      ref: ${{ github.event.pull_request.head.sha }}
  ```

I've seen others suggest alternatives like  `pull_request_target` event (but be careful with security implications) or `push` event on feature branches instead of `pull_request`


Sangeeth Sudheer (@runofthemillgeek) · 2026-01-07

[quote="amyegan, post:4, topic:30599"]
Vercel’s auto preview deployments use the actual PR head commit , not the speculative merge commit that GitHub Actions uses by default.

[/quote]

I see. Is there an option to go for the GitHub behavior? I can understand though why that might be undesirable for preview envs.


Amy Egan (@amyegan) · 2026-01-07 · ♥ 1

Using GitHub Actions instead of Vercel's automatic deployment workflow would give you more control over which commit gets deployed.

https://vercel.com/kb/guide/how-can-i-use-github-actions-with-vercel

There's a [Vercel project git configuration option](https://vercel.com/docs/project-configuration/git-configuration) that will let you disable the automatic deployments so you can handle it GitHub Actions if that's what you want to do.


Sangeeth Sudheer (@runofthemillgeek) · 2026-01-07 · ♥ 1

Yeap, we’re leaning strongly towards this now. I can imagine why Vercel’s current approach is unchanged but would be nice to have more GitHub Actions or External CI-first integrations (e.g. custom GH action) to do this.


Sangeeth Sudheer (@runofthemillgeek) · 2026-02-16

Hiya @amyegan. I was trying to set this workflow up for our main project. Came across this thread: https://community.vercel.com/t/deploy-command-not-having-a-branch-option/2457

I’m running `vercel deploy --prebuilt` since the project is already built in the action. The suggestion to use `github.event.pull_request.head.sha` helped but I’m still not seeing branch details/branch domain when deployed from within the action (just `HEAD`):

![image|690x266](upload://yFYCl8AhWhFNrFAqWXATpXrw3g5.png)

Do I need to manually set some of the env variables outlined in https://vercel.com/docs/environment-variables/framework-environment-variables for this to work? I’m also not seeing the source files that would otherwise be present in a deployment created using the GitHub app integration.

I haven’t tried the suggestion to just run `vercel deploy` and let Vercel do the build but what I was hoping to do was to do built within GitHub itself.