繁体   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