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 password-protected vercel deployments #26

Merged
merged 41 commits into from
Feb 2, 2022

Conversation

JoshBarr
Copy link
Contributor

Hey @patrickedqvist, thanks for making this library!

I'm sure you love unsolicited PRs as much as any other maintainer 😅 Apologies in advance!

We've been looking for a way to run our e2e tests against the preview URL for a while. We password protect all our preview deployments, so we needed a way sign in programmtically inside the action.

Here's a summary of what's changed:

Functional changes

  • Adds support for a vercel_password input, which is used to obtain a _vercel_jwt cookie for browsing authenticated sites.
  • Since we're going to the trouble of parsing the JWT, we make it available as an output, so that it can passed on to e2e tests.

bug fixes

  • Fixed an issue where the deployment notification would never resolve, if there was another non-vercel deployment running in another workflow on the same PR. We look up the deployment that's triggered by vercel[bot] rather than just taking the first deployment.
  • Fixed a couple of minor flow control things, where the code would keep running after setFailure(), which sometimes resulted in double errors

dev experience and CI

  • Adds a prettier config
  • Added a few unit tests with Jest and MockServiceWorker
  • Adds a workflow for running the unit tests
  • Dropped the node_modules from the package, in favour of compiling the project with ncc. This is apparently how GitHub build most of their actions.

@patrickedqvist
Copy link
Owner

@JoshBarr Thank you so much for your contribution!

Unsolicited PRs are more than welcome since I don't always have the time to add new features myself. I scrolled through your changes which looks good but I'm going to make a more thorough review soon.

@JoshBarr
Copy link
Contributor Author

Thanks Patrick! Let me know if there's things I can improve, clarify or change to fit with your plans for this library, too! :)

I've updated the test workflow to include code coverage reporting:

Screen Shot 2022-01-14 at 6 40 55 AM

If you re-run the workflow (it needs approval), we should get an automatic comment on the PR with our coverage metrics.

@JoshBarr
Copy link
Contributor Author

JoshBarr commented Jan 19, 2022

It looks like the coverage reporting step failed. I've reverted that change for now.

@JoshBarr
Copy link
Contributor Author

I fixed another edge case: when fetching the initial list of deployments for the PR, it's possible that the wait-for-vercel action gets triggered before vercel has reported its first deployment status. I've modified the action so that it waits for a deployment to show up from vercel[bot] before checking the status of it.

@patrickedqvist patrickedqvist merged commit 0bdda3c into patrickedqvist:master Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants