Search among repositories only accessible to the GitHub App #138188
Replies: 3 comments 1 reply
-
|
cc: @vermakhushboo To list repositories only accessible to your GitHub App, you should use the
GET /search/repositories?q=user:USERNAME
Authorization: Bearer <installation_access_token>https://github.com/orgs/community/discussions/24382 |
Beta Was this translation helpful? Give feedback.
-
|
Hey, @vermakhushboo I sincerely apologize for the earlier suggestion regarding the The
Unfortunately, there isn’t a way to limit the results to only those repositories explicitly accessible to your GitHub App, as per your example of 2 public and 2 private repositories. Correct ApproachTo achieve this, you should not use the Let's take an example of how it works here:You have 7 repositories in total:
You grant access to your GitHub App only to: You want to list only the 5 repositories that your GitHub App has access to. repo-2, repo-3, repo-4, repo-6, and repo-7
POST /app/installations/{installation_id}/access_tokens
Authorization: Bearer <JWT>
Accept: application/vnd.github+json
GET /installation/repositories
Authorization: Bearer ghs_exampleToken123
Accept: application/vnd.github+jsonResponse{
"total_count": 5,
"repositories": [
{ "name": "repo-2", "private": false },
{ "name": "repo-3", "private": false },
{ "name": "repo-4", "private": false },
{ "name": "repo-6", "private": true },
{ "name": "repo-7", "private": true }
]
}Conclusion:By using the Reference: |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I want to use only one API call to search and list repositories only accessible to my GitHub app. If I am using
GET /search/repositoriesendpoint with my GitHub app access token, I am getting private repos accessible to my app + all public repos even if GitHub app doesn't have access to them. How can I make it work like expected?Beta Was this translation helpful? Give feedback.
All reactions