octokat.js
octokat.js copied to clipboard
Get list of organization repositories
Hi there!
I got an error when I try to get a list of repositories belong to an organization. The code is like
const repos = await octokat.orgs(ORG_NAME).repos.fetchAll();
I got a correct result, however, octokat.js prints out a validation error.
Octokat BUG: Invalid Path. If this is actually a valid path then please update the URL_VALIDATOR. path=https://.../api/v3/organizations/.../repos?page=2
Could you fix this? Thanks!
I have the same issue, this is because for the calls after the first, the url for the next page returned from github is:
https://github.example.com/api/v3/organizations/49/repos?page=2
So that is organizations instead of orgs, which the first page uses. The first call does not fail the url validation.
The same url pattern need to be repeated for organizations url, the same as for orgs url https://github.com/philschatz/octokat.js/blob/41ddab98b3a58c86b88c08dd68ffb4b9ad8775ea/src/grammar/url-validator.coffee#L51-L59
@mokkabonna I'm hitting this same problem but unsure how to apply your suggested solution. Is there any chance you can raise a PR with the change in?
Was this ever fixed? I'm attempting to do this now with 0.10.0 and am seeing the Octokat BUG: Invalid Path. error