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

Repo Information Module #1

Open
robert4man opened this issue Sep 29, 2021 · 4 comments
Open

Repo Information Module #1

robert4man opened this issue Sep 29, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@robert4man
Copy link
Contributor

robert4man commented Sep 29, 2021

As an Ansible user I want to fetch information about repositories I have access to for use in loops. Scope should be limited to an org. Should return a list of dicts containing information about each repository such as name, owner, description, private, is_template, archived, language, visibility, and url.

Reference:
https://docs.github.com/en/rest/reference/repos#list-organization-repositories

@robert4man robert4man added the enhancement New feature or request label Sep 29, 2021
@ikogan
Copy link

ikogan commented Sep 29, 2021

I'd like this to be filterable by some of these attributes, for example, name, is_template, archived, owner, and private as well. Additionally, the structure of the output should match, as much as is reasonable, the output from the API itself so it's easier to understand from reading docs. I think a few other fields may be immediately useful, for example:

  • default_branch
  • hooks_url
  • clone_url

I mean, should we just return the entire JSON dict we get from json.loads() rather than filtering the fields?

@robert4man
Copy link
Contributor Author

There is a lot more in the JSON than we will want or need, and I didn't want the payload getting too large. We are expecting several hundred repositories and the primary intent for this module is to fetch a list of repositories for loops, but a few key data points seem obviously useful. Adding more later should not be terribly difficult.

@ikogan
Copy link

ikogan commented Sep 29, 2021

The URLs it gives you, for example, are also useful for things like subsequent calls. For example, get a list of your repos, iterate over each and use the branches_url to pull down the branches, or the git_url to clone them. Maybe you want to make a change to each but you don't have all the permissions so you can use permissions.push. The payload is going to come back whether you like it or not, you can't tell the API to limit certain fields as far as I can see. The API is already paginated so the payload is going to be limited per call. Speaking of which, that kind of begs for returning an Iterable of dicts instead of a list.

Also, is it better to use https://pygithub.readthedocs.io/en/latest/introduction.html rather than querying the API directly?

@robert4man
Copy link
Contributor Author

We will probably end up using PyGithub for all of these modules. I am simply providing the GitHub API docs for reference.

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

No branches or pull requests

2 participants