amondnet / vercel-action

This action make a deployment with github actions instead of Vercel builder.
https://vercel.com/docs/cli
MIT License
619 stars 95 forks source link

.git not found when using working-directory #149

Open wmcheung opened 2 years ago

wmcheung commented 2 years ago

I'm using vercel-action only to deploy to Vercel, while the build is done in Github Actions

      - name: Checkout main repo
        uses: actions/checkout@v3
        with:
          path: main
          fetch-depth: 0

      - name: Checkout UI
        uses: actions/checkout@v3
        with:
          repository: company/some-repo
          path: ui

     # the rest of the steps to perform a build

      - uses: amondnet/vercel-action@v19 #deploy
         with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }} 
          vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
          working-directory: main

What I've encountered is that the working-directory is called after running a git log. Which means that deploy is not happening inside the working-directory. Vercel action will try to look for history using git in the root where no .git is available.

My current workaround is to have the main repo without a path. But for multi checkout purpose I think the index.js file should be updated to have a path option to tell vercel-action where the root of the project is? While having working-directory option to provide the full path of the static build?

https://github.com/amondnet/vercel-action/blob/f445edf99fe899f0797463ca6b010746ce4e910e/index.js#L360. https://github.com/amondnet/vercel-action/blob/f445edf99fe899f0797463ca6b010746ce4e910e/index.js#L114-L116

amondnet commented 2 years ago

@wmcheung Try this.

uses: amondnet/vercel-action@e610ddb0e844d1a22c4b27560c224f84f20f3061
with:
  working-directory: your-working-dir
  git-directory: your-git-dir
nazariyv commented 1 year ago

I had the same issue, and running this action off that commit works well. However, this is a nit, I am using VSCode with github extension and apparently it lints actions and I can see that this commit marks zeit-token as required (although, workflow runs with no issues). This isn't the case with v25 of this action, there is no such linting issue.

blavejr commented 5 months ago

Will this be fixed? I am experiencing the same issue

EvanNotFound commented 5 months ago

Same issue here