klind opened a new pull request, #8681:
URL: https://github.com/apache/incubator-devlake/pull/8681
### Summary
**What does this PR do?**
Fix GitHub plugin to show private repositories when listing the
authenticated user's own repos.
Previously, when listing repos for the PAT owner's own account, the code
used `/users/{username}/repos` which only returns public repos. Now it uses the
GitHub API's `type` field to determine if the owner is a User or Organization,
then uses the appropriate endpoint:
- **Organizations**: `/orgs/{owner}/repos`
- **Authenticated user**: `/user/repos` (includes private repos)
- **Other users**: `/users/{owner}/repos` (public only)
**Changes:**
- Add `getOwnerInfo()` to fetch owner type (User/Organization) from API
- Add `getAuthenticatedUserID()` to get current user's ID
- Use switch on owner type to select the correct endpoint
- Rename function to `listGithubOwnerRepos` and parameter to `owner`
- Add `type=all` query parameter to include all repo types
**Does this close any open issues?**
Closes https://github.com/apache/incubator-devlake/issues/8680
### Screenshots
N/A - Backend change only
### Other Information
Tested locally by setting up a GitHub connection with a PAT that has
access to private repos. Before the fix, only public repos appeared. After the
fix, private repos are now visible in the "Add Data Scope" UI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]