I am receiving an error message of AttributeError
when attempting to call a repo and its actions.
This is my current code:
from github import Github
#Authenticate with GitHub
g = Github("<user>", "<pass>") #Replace <user>, <pass> with your user login and password
#Get the repository
repo = g.get_repo('toughjay318/los-lobos') #Replace 'owner/repo' with the name of your repository
# Determine which actions have permissions set on the repo
actions = repo.get_actions()
if not actions.permissions:
print('No actions have permissions set on the repo')
else:
for action in actions.permissions:
print(f'{action} has permissions set on the repo')
# Determine if pipelines are configured for commits
pipelines = repo.get_workflows()
if not pipelines.totalCount:
print('No pipelines are configured for commits')
else:
print(f'{pipelines.totalCount} pipelines are configured for commits')
# Determine if new branches are configured for actions on commits
branch_protection = repo.get_branch_protection('main') #Replace 'main' with the name of your default branch
if not branch_protection.restrictions:
print('New branches are not configured for actions on commits')
else:
print('New branches are configured for actions on commits')
This is the full errror message:
AttributeError Traceback (most recent call last)
Input In [20], in <cell line: 12>()
8 repo = g.get_repo('toughjay318/los-lobos') #Replace 'owner/repo' with the name of your repository
11 # Determine which actions have permissions set on the repo
---> 12 actions = repo.get_actions()
14 if not actions.permissions:
15 print('No actions have permissions set on the repo')
AttributeError: 'Repository' object has no attribute 'get_actions'
I have tried changing the commands around and I cannot figure out why this error is happening. Could anyone please assist me in anyway possible?