wait-for-vercel-preview icon indicating copy to clipboard operation
wait-for-vercel-preview copied to clipboard

Multiple projects / monorepo support?

Open klarkc opened this issue 3 years ago • 10 comments

I am trying to use this in a monorepo, in vercel we can have multiple projects per repo by use of Root Directory option.

When I use this, the url output is capturing only the last deploy URL, so jobs that depends on this output uses incorrect URL. There is a way to set which project to listen for the 200 preview?

klarkc avatar Feb 22 '21 18:02 klarkc

Just found that I can use environment option to do exactly this.

Setting it to Preview - name where name is the vercel project name solves my problem.

Related #8

klarkc avatar Feb 22 '21 20:02 klarkc

@klarkc I'm trying to setup monorepo with this but not sure how this works. I've set environment like this:

environment: "Preview - app-one"

where app-one is vercel project name, but it doesn't work for me.

rodilo avatar Oct 12 '21 13:10 rodilo

I am trying to use this in a monorepo, in vercel we can have multiple projects per repo by use of Root Directory option.

@rodilo did you set the Root Directory option?

klarkc avatar Oct 12 '21 13:10 klarkc

@klarkc yes, that part is ok, monorepo deployment works as expected. But this action went into timeout even though deployment was successful.

rodilo avatar Oct 12 '21 13:10 rodilo

@rodilo looking at the code:

https://github.com/patrickedqvist/wait-for-vercel-preview/blob/e634c37510fbe9aaefcf0e66c4bcf04d657dc274/index.js#L109

It seems this listing is being fetched from the github deployments API. Maybe if you can somehow test this endpoint by yourself you can see what is the expected environment value for your deployment, this way you can match setting the environment option of this action.

Probably a vercel breaking change on this naming created this side-effect on my solution.

klarkc avatar Oct 12 '21 13:10 klarkc

@rodilo looking at the code:

https://github.com/patrickedqvist/wait-for-vercel-preview/blob/e634c37510fbe9aaefcf0e66c4bcf04d657dc274/index.js#L109

It seems this listing is being fetched from the github deployments API. Maybe if you can somehow test this endpoint by yourself you can see what is the expected environment value for your deployment, this way you can match setting the environment option of this action.

Probably a vercel breaking change on this naming created this side-effect on my solution.

Thanks, I will 👍

rodilo avatar Oct 12 '21 14:10 rodilo

Just to let other people know, this is not working anymore, vercel just sends deployment environment` without project name.

rodilo avatar Oct 14 '21 10:10 rodilo

As it not working anymore, I'm reopening the issue.

klarkc avatar Oct 14 '21 13:10 klarkc

Just figure it out. Environment will contain project name only if you have connected multiple projects from a single monorepo. I didn't have it because I've only connected one project from my monorepo repository.

rodilo avatar Dec 02 '21 15:12 rodilo

If anyone is stuck on this down the line with trying to get the right environment name note that it uses the uncommon character in-between the deployment environment and the Vercal app name. It's not the normal -.

Using that character fixed my problems. You can also just copy and paste it from here image

athammer avatar May 28 '22 05:05 athammer

In regards to mono-repos on vercel, if you use the ignore build step, this action will timeout eventually even when the build no vercel was cancelled by the ignore build step.

@klarkc What are your thoughts on adding an option for the wait job to emit the skip status if the deploy was cancelled?

trm217 avatar Sep 13 '22 13:09 trm217

@trm217 I am not aware of how vercel is working nowadays, maybe someone who is currently using monorepos on vercel would answer this.

It is blocking you of using monorepos? If not I believe I should close this issue and maybe you could open a new issue.

klarkc avatar Sep 13 '22 14:09 klarkc

@klarkc No it's not blocking, I was just sharing my thoughts :)

trm217 avatar Sep 13 '22 15:09 trm217