zentered / vercel-preview-url

GitHub Action to receive the deployment preview URL from Vercel
https://github.com/zentered/vercel-preview-url#readme
MIT License
28 stars 10 forks source link

Optional environment variable specifying the branch name to search for deployments #164

Open ykokw opened 5 days ago

ykokw commented 5 days ago

First of all, thank you for this useful action!

Is your feature request related to a problem? Please describe.

When a comment on a pull request triggers a workflow, it is not possible to specify a branch name to search for deployments in Vercel.

Considering the cost of execution, I would like to run E2E tests only once against Vercel's Preview Deployment before requesting a code review, instead of launching tests on every commit. (For example, I do not want to start E2E testing just by adding a unit test case.)

Describe the solution you'd like

If I could specify the branch name in an additional environment variable, I would be able to retrieve the commented pull request branch in a separate job and search for deployments.

Additional context

I have already created a fork and a test repository so you can see what kind of workflow I am trying to build

PatrickHeneise commented 5 days ago

Hi @ykokw ! Thanks for raising the issue.

I've seen this done with comments or labels, for example you'd comment /deploy and have a script in the action to build/deploy/run tests only then, instead of push. Another option would be to set a specific label to run tests.

If you can provide a PR that doesn't break / change the way it's picking the current branch, but "overwrites" the branch if the environment variable is set, I can merge that.

ykokw commented 20 hours ago

@PatrickHeneise Thank you for your response.

I have prepared a PR and would be happy to review it when you are available.