-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Methods called on Secret and Variable model methods are not requesting the correct GitHub REST API endpoint URLs. Invoking these methods causes 404 errors.
- For
Variable, there is a bug that appends additional incorrect parts to the variable's REST API endpoint URL, resulting in 404 errors fordelete(HTTPDELETE) andedit(HTTPPATCH).- Example:
- Expected:
/repos/{owner}/{repo}/actions/variables/{name} - Actual:
/repos/{owner}/{repo}/actions/variables/{name}/actions/variables/{name}
- Expected:
- Example:
- For both
VariableandSecret, fetching aPaginatedListof either from theRepositorymodel'sget_variablesorget_secretsmethods fails to correctly set the_urlattribute on the paginated list of models. Therefore, calling such methods will also fail.
Below are some examples for how to reproduce the unexpected behavior. Please substitute "AndrewJDawes/PyGithub" with the owner/name of a repository to which you have access.
# Setup
repo = self.g.get_repo("AndrewJDawes/PyGithub")
variable = repo.create_variable("VARIABLE_NAME", "VARIABLE_VALUE")
repo = self.g.get_repo("AndrewJDawes/PyGithub")
variable = repo.get_variable("VARIABLE_NAME")
# Issue
variable.delete() # github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest"}repo = self.g.get_repo("AndrewJDawes/PyGithub")
repo.create_variable("VARIABLE_ONE_NAME", "VARIABLE_ONE_VALUE")
repo.create_variable("VARIABLE_TWO_NAME", "VARIABLE_TWO_VALUE")
repo = self.g.get_repo("AndrewJDawes/PyGithub")
variables = repo.get_variables()
for variable in variables:
if variable.name in ["VARIABLE_ONE_NAME", "VARIABLE_TWO_NAME"] and variable.value in ["VARIABLE_ONE_VALUE", "VARIABLE_TWO_VALUE"]:
variable.delete() # Fails to delete Variable repo = self.g.get_repo("AndrewJDawes/PyGithub")
repo.create_secret("SECRET_ONE_NAME", "SECRET_ONE_VALUE")
repo.create_secret("SECRET_TWO_NAME", "SECRET_TWO_VALUE")
repo = self.g.get_repo("AndrewJDawes/PyGithub")
secrets = repo.get_secrets()
for secret in secrets:
if secret.name in ["SECRET_ONE_NAME", "SECRET_TWO_NAME"]:
secret.delete() # AttributeError: 'NoneType' object has no attribute 'startswith'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels