Skip to content

Instantly share code, notes, and snippets.

@skwashd
Created August 26, 2019 16:24
Show Gist options
  • Select an option

  • Save skwashd/b07b4e531b3d1fd305912fd2985c37ec to your computer and use it in GitHub Desktop.

Select an option

Save skwashd/b07b4e531b3d1fd305912fd2985c37ec to your computer and use it in GitHub Desktop.

Revisions

  1. skwashd created this gist Aug 26, 2019.
    33 changes: 33 additions & 0 deletions enable-github-security-tooling.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    #!/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()