AI Hints
CI/CD with GitHub Actions · Lesson 68 of 138

Dependabot

Automatic updates.

⏱ 2 min read▶ Video at 1:18:07🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Updating dependencies is boring, so people forget. Dependabot is a GitHub bot that checks for new versions, and opens pull requests to update them. Your CI then tests each update, so you can merge it with confidence.

Dependabot
From the video: Dependabot
  • Updating is boring
  • Dependabot opens PRs
  • CI tests each one

dependabot.yml

The file lives at dot github slash dependabot dot y m l. Each entry under updates is one ecosystem. Here, pip packages, checked weekly. And a second entry for github actions, so the actions in your workflows stay up to date too.

.github/dependabot.ymlyaml
version: 2
updates:
  - package-ecosystem: pip
    directory: "/"
    schedule:
      interval: weekly
  - package-ecosystem: github-actions
    directory: "/"
    schedule:
      interval: weekly

Checking the file

Dependabot only reads the file on GitHub, but we can check that it's valid YAML, and see what it will watch. Python loads it, and prints each ecosystem with its schedule.

Terminal
python3 -c "import yaml; [print(u['package-ecosystem'], '->', u['schedule']['interval']) for u in yaml.safe_load(open('.github/dependabot.yml'))['updates']]"
pip -> weekly
github-actions -> weekly

Summary

Dependabot opens pull requests to update dependencies and actions, and CI tests each one. Next, catching passwords before they leak.

Key takeaways
  • .github/dependabot.yml
  • pip, npm, github-actions
  • CI tests every update
Next up: Secret Scanning — keys that slip into code