Vercel關閉評論 禁止Preview Deployments

關鍵字:disable Vercel bot; disable Preview Deployments

Vercel是一個支持部署前端框架和靜態網站的平臺。你可以方便的把 Github Pages 上面的站點導入Vercel,這樣做有兩個好處:

  1. 有些地區有些時候,Vercel上面的站點比Github Pages上的訪問速度快;
  2. Github Pages 屏蔽了百度的爬蟲,因此你的博客不能被百度檢索到。但 Vercel 是可以的。

使用了一段時間的Vercel,發現有兩個地方需要調整。

關閉評論

每次提交後,vercel bot會在該commit下評論:

image.png

這造成了大量的github通知和郵件通知:

image.png

如何關閉?在站點根目錄新增vercel.json文件,內容如下:

{
    "github": {
        "silent": true
    }
}

禁止Preview Deployments

另一個需要關閉的就是Preview Deployments(與我而言)。我的站點沒有預覽的必要,都是直接build main分支然後上production。Preview Deployments 構建的是gh-pages分支,可能是我哪裏沒弄對,這個分支一直無法build成功。如下圖,2小時過去了還沒結束,然後我手動取消了。

image.png

因此,我禁止了Preview Deployments,直允許Production Deployments。操作如下:
Project Settings -> Git -> Ignored Build Step,在 COMMAND 填入 [ "$VERCEL_ENV" != production ]
image.png

Reference

  1. How do I prevent the Vercel for GitHub integration comments? – Vercel Docs
  2. Using Vercel without preview deployments (codejam.info)

本文同步發佈於:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章