注意
站点管理员必须先为 你的 GitHub Enterprise Server 实例设置 Dependabot updates,然后你才能使用此功能。 有关详细信息,请参阅 为企业启用 Dependabot.
如果企业所有者在企业级别设置了策略,你可能无法启用或禁用 Dependabot updates。 有关详细信息,请参阅“强制实施企业的代码安全性和分析策略”。
当你为 GitHub Actions 启用 Dependabot version updates 后,Dependabot 将帮助确保存储库的 workflow.yml 文件中对操作的引用,以及工作流中使用的可重用工作流,始终保持最新。 有关详细信息,请参阅“关于 Dependabot 版本更新”。
为操作启用 Dependabot version updates
- 如果你已经为其他生态系统或包管理器启用 Dependabot version updates,只需打开现有的
dependabot.yml文件。 否则,在存储库的dependabot.yml目录中创建一个.github配置文件。 有关详细信息,请参阅“配置 Dependabot 版本更新”。 - 指定
"github-actions"为要监视的package-ecosystem。 - 设置
directory为"/",检查.github/workflows中的工作流文件。 - 设置
schedule.interval以指定检查新版本的频率。 - 将 dependabot.yml 配置文件签入存储库的
.github目录中。 如果已编辑现有文件,请保存所做的更改。
您也可以在复刻上启用 Dependabot version updates。 有关详细信息,请参阅“配置 Dependabot 版本更新”。
例如用于 GitHub Actions
的 dependabot.yml 文件
下面的示例 dependabot.yml 文件配置 GitHub Actions
的版本更新。
directory 必须设置为 "/" 以检查 .github/workflows 中的工作流文件。
schedule.interval 设置为 "weekly"。 在该文件被检入或更新后,Dependabot 将检查您的操作的新版本。 Dependabot 在发现任何过时的操作时,将会提出版本更新的拉取请求。 在初始版本更新后,Dependabot 将继续每周检查一次过时的操作版本。
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
为操作配置 Dependabot version updates
为操作启用 Dependabot version updates 时,必须指定 package-ecosystem、directory 和 schedule.interval 的值。 您可以设置更多可选属性来进一步自定义版本更新。 有关详细信息,请参阅“Dependabot 选项参考”。
延伸阅读
-
[AUTOTITLE](/actions/learn-github-actions)