HomeBlogWorksCode
How to save 20 USD per seat per month on Vercel

How to save 20 USD per seat per month on Vercel

By @Johnatan

Share with
Next.js

Like many others, I use Vercel to deploy my projects. I have a few side projects that I’ve been developing with friends as a hobby. However, with a recent update, Vercel stopped showing preview deployments for some of my collaborators due to a new verification system.

This caused some delays, as we had to manually pull the changes from other branches locally in order to review them. The issue stems from Vercel’s new requirement that only verified team members can trigger preview deployments.

This means that:

  1. You now need to have a Pro plan.
  2. You must pay $20 per project member to grant them access.

Looking for a workaround to keep using preview deployments, I came up with an idea that, while not the most ethical, works well in practice.

The solution is to create a GitHub Action. Since only users with Vercel access can trigger previews, I created a GitHub Action that modifies the README file and automatically commits the changes to a specific branch. This forces Vercel to generate the preview deployment.

Here’s the code for the GitHub Action:

yaml

# /.github/workflows/update-readme.yml

name: Update README with commit message

on:
  push:
    branches:
      - recommit # The branch that you want to do a 'Preview Deployment'

permissions:
  contents: write # Required for updating README

jobs:
  update-readme:
    runs-on: ubuntu-latest

    steps:
      - name: Check out the repository
        uses: actions/checkout@v3

      - name: Set git identity to repository owner
        run: |
          git config --global user.name "{{name of the proyect owner}}""
          git config --global user.email "{{email of the proyect owner}}"

      - name: Update README
        run: |
          git log -1 --pretty=format:"- %s by %an on %ad" >> README.md
          git add README.md
          git commit -m "Update README with latest commit"
          git push

This takes you from a problem like this:

To a solution like this:

🚨

Disclaimer
This is not advice to avoid paying Vercel. It’s just an example of a vulnerability in the logic behind preview deployments. If you decide to try this, it’s at your own risk. Also, remember that GitHub Actions has a free usage limit

Published: 2024-10-07