Created
August 26, 2019 16:24
-
-
Save skwashd/b07b4e531b3d1fd305912fd2985c37ec to your computer and use it in GitHub Desktop.
Bulk enable dependabot and security alerts on github repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import os | |
import requests | |
token = os.environ.get("GITHUB_TOKEN") | |
org = os.environ.get("GITHUB_ORG") | |
repos = [ | |
# Add list of repos here | |
] | |
for repo in repos: | |
headers = { | |
"Authorization": f"token {token}", | |
"Accept": "application/vnd.github.dorian-preview+json", | |
} | |
url = f"https://api.github.com/repos/{org}/{repo}/vulnerability-alerts" | |
r = requests.put(url, headers=headers) | |
r.raise_for_status() | |
headers = { | |
"Authorization": f"token {token}", | |
"Accept": "application/vnd.github.london-preview+json", | |
} | |
url = f"https://api.github.com/repos/{org}/{repo}/automated-security-fixes" | |
r = requests.put(url, headers=headers) | |
r.raise_for_status() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment