Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GitHub repository/organization secrets #1156

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MrBatschner
Copy link

@MrBatschner MrBatschner commented Jun 21, 2023

Adds support for organization and repository secrets. As these are part of the GitHub Actions API they are put into a new submodule github3.actions.

This PR does not support environment secrets as I believe this would better live in a dedicated Environment module.

This PR would potentially fix issue #1024.

Adds support for organization and repository
secrets. As these are part of the Actions API
they are put into a new submodule
github3.actions.
Currently support OrganizationSecrets and
RepositorySecrets.

more info on the API at
https://developer.github.com/v3/actions/secrets
@MrBatschner MrBatschner changed the title Add support for GitHub secrets. Add support for GitHub repository/organization secrets Jun 22, 2023
@MrBatschner
Copy link
Author

Hey guys and @sigmavirus24, this PR is open for almost a year. I would be really glad if you could spare some time and give me some review feedback on it.

.. attribute:: updated_at
The timestamp of when the secret was last updated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must include documentation for visibility.

super()._update_attributes(secret)
self.visibility = secret["visibility"]
if self.visibility == "selected":
self._selected_repos_url = secret["selected_repositories_url"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the URL attribute "private"? It should be public and named identically to the value in the JSON.

list_key="repositories",
)

def set_selected_repositories(self, repository_ids: typing.List[int]):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer Sequence over List as a List[int] precludes Tuple[int] or any other sequence like data that Python will happily correctly serialize to a JSON Array

url = "/".join([self._selected_repos_url, str(repository_id)])
return self._boolean(self._put(url), 204, 409)

def delete_selected_repository(self, repository_id: int):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def delete_selected_repository(self, repository_id: int):
def remove_selected_repository(self, repository_id: int):

Alternatively

These should be:

  • select_repositories
  • select_repository
  • deselect_repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants