Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple preview deployments per Pull request #47

Open
MarkLyck opened this issue Dec 22, 2022 · 8 comments
Open

Support multiple preview deployments per Pull request #47

MarkLyck opened this issue Dec 22, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@MarkLyck
Copy link

MarkLyck commented Dec 22, 2022

This action works great for projects with a single Vercel deployment.

But in my case my project has 3 vercel deployments per project, and currently this action only returns the URL for the first one that runs which is random.

I would like to either have it run on all preview deployments when they are succesful or a specific one. But this doesn't seem to be supported.

@nc
Copy link

nc commented Jan 4, 2023

Any plans to fix this @patrickedqvist we'd be happy to sponsor you if this is fixed :)

@pip8786
Copy link

pip8786 commented Jan 24, 2023

@MarkLyck we're able to wait on a specific environment by doing this:

steps:
      - name: Wait for Vercel preview deployment to be ready
        uses: patrickedqvist/[email protected]
        id: waitForVercelPreviewDeployment
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          max_timeout: 600
          environment: Preview – web-app

We have 2 deployments that happens each time, but currently only interested in running on a specific one. I'm not sure about running on all of them though, maybe that would require separate actions?

Edit to add: here's the line where it passes the environment to octokit:

environment,
which I believe is this API: https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#list-deployments

@patrickedqvist
Copy link
Owner

I would love to implement this, I'm going to work on a project soon where I might be able to develop this feature properly at the same time. I happily accept contributions as well ;)

@patrickedqvist patrickedqvist added the enhancement New feature or request label Jan 25, 2023
@hjoelh
Copy link

hjoelh commented Mar 14, 2023

@patrickedqvist @MarkLyck @nc

How do you see this being done?

I see 2 things that could be nice

  1. The ability to specify multiple environments, the action checks on each one but returns whichever is first. This would be useful for when you only care about one site/project (in our case, E2E Build) but different branches cause the environments to be named differently. This is the use case I have and how I stumbled on this issue. I have an ugly fork doing this
Production - MySite
Staging - MySite
  1. Not my current use case but it might be yours, which is, the ability to specify multiple environments and wait for each one. The action would then return an object with property names of the environments you specified with its corresponding URL. Something like
waitFor200.outputs['Staging - MySite'].url
waitFor200.outputs['E2E - MySite'].url
waitFor200.outputs['Demo - MySite'].url

What do you think?

@filipkowal
Copy link

@pip8786 How did you find the name of the environment? I am creating a preview deployment with testing branch so I tried: "Preview - testing", "testing" and "Preview", but none of them works (no deployments found).

A workaround solution I use now, is to change the preview_url field value from the output variable to the general latest branch deployment URL https://[projectName]-git-[branchName]-[gitUserName].vercel.app

in my case:

outputs:
      preview_url: https://jobs-git-testing-filipkowal.vercel.app

@hjoelh
Copy link

hjoelh commented Dec 4, 2023

@pip8786 How did you find the name of the environment? I am creating a preview deployment with testing branch so I tried: "Preview - testing", "testing" and "Preview", but none of them works (no deployments found).

A workaround solution I use now, is to change the preview_url field value from the output variable to the general latest branch deployment URL https://[projectName]-git-[branchName]-[gitUserName].vercel.app

in my case:

outputs:
      preview_url: https://jobs-git-testing-filipkowal.vercel.app

Hey @filipkowal, the name of the environment is whatever this says for you. Can be Production, Preview, Preview - YourApp, Production - YourApp etc.

CleanShot 2023-12-04 at 4  17 11

@pip8786
Copy link

pip8786 commented Dec 4, 2023

@filipkowal Just confirming that what @hjoelh posted is correct. That part of the comment from Vercel is what we used to filter the Github action by environment.

@letehaha
Copy link

Apparently, it looks like you cannot pass "part" of the deployment name. In my case, Preview has the Preview – foo name, and production has the Production – foo name. Being able to pass environment: foo could be so nice to have. But for now this code covered my needs:

environment: ${{ github.ref == 'refs/heads/master' && 'Production – foo' || 'Preview – foo' }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants