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

How to run the workflow against private repositories within organization #17

Closed
shahmanthan1209 opened this issue Jun 5, 2023 · 4 comments · Fixed by #21
Closed

How to run the workflow against private repositories within organization #17

shahmanthan1209 opened this issue Jun 5, 2023 · 4 comments · Fixed by #21
Assignees
Labels
question Further information is requested

Comments

@shahmanthan1209
Copy link

Hi team,
Can you please advise on how to run the GitHub action against the private repositories?

@ahatzz11
Copy link
Contributor

ahatzz11 commented Jun 5, 2023

I would also like to do this! The GH_TOKEN that I am passing is a Personal Access Token that has read/write to every repository in our organization, but it seems to only be grabbing public repos. I ran a report with INACTIVE_DAYS: 1 and only got a few dozen repos - I expected close to 500 from our private organization.

@ahatzz11
Copy link
Contributor

ahatzz11 commented Jun 5, 2023

I did a little research on this, and it seems like a little oversight in the 3rd party GitHub python library that was chosen:

Some docs about the current method being used: https://github3.readthedocs.io/en/latest/api-reference/github.html#github3.github.GitHub.repositories_by

List public repositories for the specified username.

Based on some other docs (which are 3 years old, and the github3.py lib seems to kinda have some unclear documentation around this), it seems like this line:

for repo in github_connection.repositories_by(organization):

Should be replaced with:

org = github_connection.organization(organization)
for repo in org.repositories():

I'm definitely not a python expert so the above might not be 100% correct, but I think the repositories_by(organization) method call is the root of this issue.

@zkoppert zkoppert added the question Further information is requested label Jun 5, 2023
@zkoppert
Copy link
Member

zkoppert commented Jun 5, 2023

👋🏻 Hi @shahmanthan1209 and @ahatzz11, That looks correct to me so I ran a quick test and it does in fact grab the private repos as long as the token has permission. When I designed this, I had in mind that this would be for public repos but no reason it couldn't be used internally as well!

I'll open up a PR and tag you all on it.

@zkoppert
Copy link
Member

zkoppert commented Jun 6, 2023

This is now released in v.1.1.0. 🎉

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

Successfully merging a pull request may close this issue.

3 participants