注意
站点管理员必须先为 Dependabot updates设置 你的 GitHub Enterprise Server 实例,然后你才能使用此功能。 有关详细信息,请参阅 为企业启用 Dependabot.
如果企业所有者在企业级别设置了策略,你可能无法启用或禁用 Dependabot updates。 有关详细信息,请参阅“强制实施企业的代码安全性和分析策略”。
为Dependabot version updates启用GitHub Actions后,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 选项参考”。