When I try accessing VERCEL_GIT_PREVIOUS_SHA in my ignore build script (bash) the environmental variable is always empty. I can see all the other system variables, but for some reason this one is always empty.
Hey @ryan-greenfieldla. VERCEL_GIT_PREVIOUS_SHA
points to the SHA from the last successful deployment for the project and branch. So it’s always empty on the first push of a branch, because that branch has never deployed before.
Does the project already have a successful deployment from that branch?
Ah that makes sense. I am hoping to run the ignore script on new branches to help determine if it should deploy a preview build if the branch had files changed within certain folders. Is there a better method to do this?
If it’s a monorepo, you could use this: Automatically skip unnecessary deployments in monorepos
Or something like this might work, possibly with VERCEL_GIT_COMMIT_SHA
depending on your project needs: With Folders and Workspaces
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.