Skip to content

Instantly share code, notes, and snippets.

Created August 27, 2019 03:50
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save skwashd/3ffc1ab9230224001455151813b41648 to your computer and use it in GitHub Desktop.
Batch create dependabot config.yml file in github repos
#!/usr/bin/env python3
import base64
import os
import requests
token = os.environ.get("GITHUB_TOKEN")
org = os.environ.get("GITHUB_ORG")
config_file = os.environ.get("DEPENDABOT_CONFIG_FILE", "dependabot-config.yml")
commit_message = "I didn't configure the script properly"
name = "Dave's Dependabot Script"
email = ""
repos = [
# Add list of repos here.
with open(config_file, "rb") as f:
config =
config_b64 = base64.b64encode(config).decode("utf-8")
headers = {"Authorization": f"token {token}"}
for repo in repos:
url = f"{org}/{repo}/contents/.dependabot/config.yml"
payload = {
"author": {"name": name, "email": email},
"content": config_b64,
"message": commit_message,
r = requests.put(url, headers=headers, json=payload)
# Full config file configuration available at
version: 1
- package_manager: "python"
directory: "/"
update_schedule: "live"
- match:
dependency_type: "all"
update_type: "semver:minor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment