Skip to content

Instantly share code, notes, and snippets.

@rdkls
Created April 19, 2021 01:16
Show Gist options
  • Save rdkls/6b1d14c4ca52417716c11f3dad05bbaf to your computer and use it in GitHub Desktop.
Save rdkls/6b1d14c4ca52417716c11f3dad05bbaf to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from github import Github
from pprint import pprint
import requests
TOKEN = 'PERSONAL_ACCESS_TOKEN'
g = Github(TOKEN)
for repo in g.get_user().get_repos(visibility='public'):
owner_name = repo.owner.login
repo_name = repo.name
url = f'https://api.github.com/repos/{owner_name}/{repo_name}/actions/permissions'
print(url)
res = requests.put(
url=url,
data='{"enabled":false}',
headers={
'Authorization': f'token {TOKEN}',
'Accept': 'application/vnd.github.v3+json',
}
)
pprint(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment