簡體   English   中英

我可以從 GitHub Dependabot 中排除目錄嗎?

[英]Can I exclude directories from GitHub Dependabot?

我的倉庫中有一個目錄/experiments ,其中包含 - surprise。 - 實驗。 這些通常帶有自己的package.json ,其中包括在我進行實驗時是最新的但現在可能已經過時的依賴項。 我無意讓它們保持最新,因為實驗只是概念的證明——我可能想在項目的后期使用這些概念,但我會在主項目中重新實施。

不幸的是,Dependapot 向我發送了很多關於/experiments中的依賴項的 PR。 其中許多需要我手動操作。 所以我想告訴 Dependabot 不要發送任何通知或為/experiments目錄中的所有內容創建 PR(但要繼續為主項目中的依賴項創建 PR)。

我並沒有找到太多關於如何在 GitHub 上配置 Dependabot 的文檔,但我想到了這個:

/.github/dependabot.yml

version: 2
updates:

  # Ignore experiments:
  - package-ecosystem: "npm"
    directory: "/experiments"
    schedule:
      interval: "daily"
    ignore:
      - dependency-name: "*"

雖然它似乎不起作用。 今天我收到了來自 Dependabot 的另一個 PR,該 PR 影響了/experiments中的一個依賴項。 它是自動合並的,所以我沒有任何努力,但仍然有點煩人。

我該怎么做呢?

截至 2022 年 2 月,這似乎是不可能的: https://github.com/dependabot/dependabot-core/issues/4364

我剛剛在這個 GitHub 問題中找到了答案: https://github.com/dependabot/dependabot-core/issues/2276

它表示沒有排除文件夾的配置,但您可以在.github/dependabot.yml配置文件中包含這些配置。 Dependabot 將僅掃描其配置中包含的文件夾。

Eg the following configuration will make Dependabot scan only the GitHub Actions in your .github/workflows/ folder, the package.json in the root of your repository and the package.json in the client folder. 這樣, experiments文件夾將不會被掃描。

version: 2
updates:
  # --- GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

  # --- Root
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "daily"
  
  # --- Client package
  - package-ecosystem: "npm"
    directory: "/client"
    schedule:
      interval: "daily"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM