Skip to main content

Keeping your actions up to date with Dependabot

You can use Dependabot to keep the actions you use updated to the latest versions.

About Dependabot 版本更新 for actions

Actions are often updated with bug fixes and new features to make automated processes more reliable, faster, and safer. When you enable Dependabot 版本更新 for GitHub Actions, Dependabot will help ensure that references to actions in a repository's workflow.yml file are kept up to date. For each action in the file, Dependabot checks the action's reference (typically a version number or commit identifier associated with the action) against the latest version. If a more recent version of the action is available, Dependabot will send you a pull request that updates the reference in the workflow file to the latest version. For more information about Dependabot 版本更新, see "About Dependabot 版本更新." For more information about configuring workflows for GitHub Actions, see "Learn GitHub Actions."

注意: 由 Dependabot 拉取请求触发的工作流程运行就像是来自复刻的仓库一样, 并因此使用只读 GITHUB_TOKEN。 这些工作流程运行无法访问任何密钥。 请参阅“确保 GitHub Actions 和工作流程安全:阻止 pwn 请求”,了解确保这些工作流程安全的策略。

Enabling Dependabot 版本更新 for actions

  1. 创建 dependabot.yml 配置文件。 If you have already enabled Dependabot 版本更新 for other ecosystems or package managers, simply open the existing dependabot.yml file.
  2. Specify "github-actions" as a package-ecosystem to monitor.
  3. Set the directory to "/" to check for workflow files in .github/workflows.
  4. Set a schedule.interval to specify how often to check for new versions.
  5. dependabot.yml 配置文件签入仓库的 .github 目录。 If you have edited an existing file, save your changes.

You can also enable Dependabot 版本更新 on forks. For more information, see "Configuring Dependabot version updates."

Example dependabot.yml file for GitHub Actions

The example dependabot.yml file below configures version updates for GitHub Actions. The directory must be set to "/" to check for workflow files in .github/workflows. The schedule.interval is set to "daily". After this file has been checked in or updated, Dependabot checks for new versions of your actions. Dependabot will raise pull requests for version updates for any outdated actions that it finds. After the initial version updates, Dependabot will continue to check for outdated versions of actions once a day.

# Set update schedule for GitHub Actions

version: 2
updates:

  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      # Check for updates to GitHub Actions every weekday
      interval: "daily"

Configuring Dependabot 版本更新 for actions

When enabling Dependabot 版本更新 for actions, you must specify values for package-ecosystem, directory, and schedule.interval. There are many more optional properties that you can set to further customize your version updates. For more information, see "Configuration options for the dependabot.yml file."

Further reading