Question about github action and vercel

i have github action that look like this

name: CI

on:
  pull_request:
    branches: ["*"]
  merge_group:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

# You can leverage Vercel Remote Caching with Turbo to speed up your builds
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds
env:
  FORCE_COLOR: 3
  TURBO_TEAM: ${{ vars.TURBO_TEAM }}
  TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
  AUTH_DESCOPE_MAIN_TENANT_ID: ${{ secrets.AUTH_DESCOPE_MAIN_TENANT_ID }}
  NEXT_PUBLIC_AUTH_DESCOPE_ID: ${{ secrets.NEXT_PUBLIC_AUTH_DESCOPE_ID }}
  AUTH_DESCOPE_MGT_KEY: ${{ secrets.AUTH_DESCOPE_MGT_KEY }}
  AUTH_DESCOPE_ISSUER: ${{ secrets.AUTH_DESCOPE_ISSUER }}
  AUTH_DESCOPE_SECRET: ${{ secrets.AUTH_DESCOPE_SECRET }}
  NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
  AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
  KV_URL: ${{ secrets.KV_URL }}
  KV_REST_API_URL: ${{ secrets.KV_REST_API_URL }}
  KV_REST_API_TOKEN: ${{ secrets.KV_REST_API_TOKEN }}
  KV_REST_API_READ_ONLY_TOKEN: ${{ secrets.KV_REST_API_READ_ONLY_TOKEN }}
  BLOB_STORAGE_URL: ${{ secrets.BLOB_STORAGE_URL }}
  BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
  POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
  VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
  VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
  # REGISTRY: ghcr.io
  # IMAGE_NAME: ${{ github.repository }}
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Copy env
        shell: bash
        run: cp .env.example .env

      - name: Lint
        run: pnpm lint && pnpm lint:ws

  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Format
        run: pnpm format

  typecheck:
    runs-on: ubuntu-latest
    needs: [lint, format]
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Typecheck
        run: pnpm typecheck
  deploy-Preview:
    runs-on: ubuntu-latest
    needs: [lint, format, typecheck]
    steps:
      - uses: actions/checkout@v2
      - name: Install Vercel CLI
        run: npm install --global vercel@latest
      - name: Pull Vercel Environment Information
        run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
      - name: Build Project Artifacts
        run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
      - name: Deploy Project Artifacts to Vercel
        run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

now my issue that this runn the deployment before the flow of github action ends is there a way block this means github flow end success then do the acual deployment i dont understand what i missing here

Hey,

If you’re using GitHub Actions for something else already, you could move the whole deployment to that workflow. See “How can I use GitHub Actions with Vercel?” for a walkthrough.

Setting github.enabled to false in vercel.json should prevent Vercel for GitHub from deploying the project.

just small correction i wrote this github action no one else
also i did set to false when i do push to the pr it automaticly add as pandding and not waiting for github actions task to be done
this how it look

{
  "framework": "nextjs",
  "cleanUrls": true,
  "crons": [],
  "git": {
    "enabled": false
  }
}

for small context the deploay happend after the typecheck job
but it add when the push happend

git.enabled isn’t the correct syntax. It has to be github.enabled. : Git Configuration

1 Like

ok this one now i have one more issue i keep getting


[25](https://github.com/Sivanwol/sabo-project/actions/runs/10922612582/job/30317507796?pr=2#step:3:26)Vercel CLI 37.4.0

[26](https://github.com/Sivanwol/sabo-project/actions/runs/10922612582/job/30317507796?pr=2#step:3:27)Error: No existing credentials found. Please run `vercel login` or pass "--token"

[27](https://github.com/Sivanwol/sabo-project/actions/runs/10922612582/job/30317507796?pr=2#step:3:28)Learn More: https://err.sh/vercel/no-credentials-found

[28](https://github.com/Sivanwol/sabo-project/actions/runs/10922612582/job/30317507796?pr=2#step:3:29)Error: Process completed with exit code 1.

this new updated github action file

name: CI

on:
  pull_request:
    branches: ["*"]
  merge_group:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

# You can leverage Vercel Remote Caching with Turbo to speed up your builds
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds
env:
  FORCE_COLOR: 3
  TURBO_TEAM: ${{ vars.TURBO_TEAM }}
  TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
  AUTH_DESCOPE_MAIN_TENANT_ID: ${{ secrets.AUTH_DESCOPE_MAIN_TENANT_ID }}
  NEXT_PUBLIC_AUTH_DESCOPE_ID: ${{ secrets.NEXT_PUBLIC_AUTH_DESCOPE_ID }}
  AUTH_DESCOPE_MGT_KEY: ${{ secrets.AUTH_DESCOPE_MGT_KEY }}
  AUTH_DESCOPE_ISSUER: ${{ secrets.AUTH_DESCOPE_ISSUER }}
  AUTH_DESCOPE_SECRET: ${{ secrets.AUTH_DESCOPE_SECRET }}
  NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
  AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
  KV_URL: ${{ secrets.KV_URL }}
  KV_REST_API_URL: ${{ secrets.KV_REST_API_URL }}
  KV_REST_API_TOKEN: ${{ secrets.KV_REST_API_TOKEN }}
  KV_REST_API_READ_ONLY_TOKEN: ${{ secrets.KV_REST_API_READ_ONLY_TOKEN }}
  BLOB_STORAGE_URL: ${{ secrets.BLOB_STORAGE_URL }}
  BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
  POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
  VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
  VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
  VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
  # REGISTRY: ghcr.io
  # IMAGE_NAME: ${{ github.repository }}
jobs:
  lint:
    runs-on: ubuntu-latest
    name: Lint
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Copy env
        shell: bash
        run: cp .env.example .env

      - name: Lint
        run: pnpm lint && pnpm lint:ws

  format:
    runs-on: ubuntu-latest
    name: Format
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Format
        run: pnpm format

  typecheck:
    runs-on: ubuntu-latest
    name: Typecheck
    steps:
      - uses: actions/checkout@v4

      - name: Setup
        uses: ./tooling/github/setup

      - name: Typecheck
        run: pnpm typecheck
  deploy:
    runs-on: ubuntu-latest
    name: Deployment
    needs: [lint, format, typecheck]
    steps:
      - uses: actions/checkout@v4
      - name: Pull Vercel Environment Information
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Pass the token as an environment variable
        run: vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
      - name: Build Project Artifacts
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Pass the token as an environment variable
        run: vercel build --token=$VERCEL_TOKEN
      - name: Deploy Project Artifacts to Vercel
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Pass the token as an environment variable
        run: vercel deploy --prebuilt --token=$VERCEL_TOKEN

now the odd thing i do have setup everthing


have idea i may missed?

If you can hardcode the token and get it worked, I will recommend checking out with GitHub Support team to find out more information why token isn’t adding in the code.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.