Not listing private repositories for an organization I'm a member of
I've successfully authenticated a GitHub user, and am able to add both the public-repo workflow of an organization, and the private-repo workflow of the user itself. However when I enter the name of an organization that the user is a member of in the "Owner" box it doesn't list the private repositories in that organization. If I visit the organization in the GitHub Web App with the same user I can see both the private repositories, and the workflows.
I suspect the problem here is that in GitHubAPI.swift to list the repositories you're either doing:
-
/users/{org}/reposfor the public repos of an owner, or -
/user/reposfor the private personal repos of the user
But I think for private repos of an organization you need to call /orgs/{org}/repos (note it's orgs not users in the first level) (see https://docs.github.com/en/[email protected]/rest/repos/repos?apiVersion=2022-11-28)
Yes and no. CCMenu calls both endpoints. You can see the logic here. But it looks like CCMenu needs to make a third API call to get the private org repos.
In the end the solution was slightly different: first find out whether the owner string is a user or an org, with another API call, and then make the correct calls.
Please have a look whether this pre-release addresses your issue: https://github.com/ccmenu/ccmenu2/releases/tag/v27.0d1
Hi @erikdoe - unfortunately it doesn't seem to. I made sure to trigger a GitHub action workflow in a private repo, but I still don't see the repo in the "Repository" list for my organization.
Could you try to push to the repo in question? CCMenu asks for the repos sorted by when changes were pushed to it. And for what it's worth, the sort options are: created, updated, pushed, full_name.
You can see what happens in the logs when starting to add a repo:
Request: GET https://api.github.com/users/thoughtworks?
First request – and this is new – to find our whether the string entered in the owner field is a user or an org. Don't by confused by the endpoint. It will return information about users and orgs and it has a field in the response to say what it was.
Then:
Request: GET https://api.github.com/orgs/thoughtworks/repos?type=all&per_page=100&sort=pushed
CCMenu has determinded from the first response that the owner – thoughtworks in this case – is an org and makes the request to the endpoint for orgs. You can see that it asks for the repos to be sorted by pushed.
Hi @erikdoe - Sorry for the delay, I was waiting to push to the main branch of one my org+private repos.
So I figured out one problem - I hadn't "granted" permission to the CCTray OAuth App in the Github Login / Auth dialog. Once I did that I can see my private workflows in the Add Pipeline window. However now I have a new problem - when I press 'Apply' in that dialog nothing happens - the window just stays open.
I just installed 27.0 from the releases page before trying.