fix(backend): Sourcebot not pulling github forked repos (#499)

This commit is contained in:
Tarang Chikhalia 2025-09-18 18:06:46 -04:00 committed by GitHub
parent c250c14fbe
commit 7020761ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed
- Fixed sourcebot not pulling github forked repos [#499](https://github.com/sourcebot-dev/sourcebot/pull/499)
## [4.7.0] - 2025-09-17 ## [4.7.0] - 2025-09-17
### Added ### Added

View file

@ -225,13 +225,17 @@ const getReposOwnedByUsers = async (users: string[], octokit: Octokit, signal: A
const { durationMs, data } = await measure(async () => { const { durationMs, data } = await measure(async () => {
const fetchFn = async () => { const fetchFn = async () => {
let query = `user:${user}`;
// To include forks in the search results, we will need to add fork:true
// see: https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories
query += ' fork:true';
// @note: We need to use GitHub's search API here since it is the only way // @note: We need to use GitHub's search API here since it is the only way
// to get all repositories (private and public) owned by a user that supports // to get all repositories (private and public) owned by a user that supports
// the username as a parameter. // the username as a parameter.
// @see: https://github.com/orgs/community/discussions/24382#discussioncomment-3243958 // @see: https://github.com/orgs/community/discussions/24382#discussioncomment-3243958
// @see: https://api.github.com/search/repositories?q=user:USERNAME // @see: https://api.github.com/search/repositories?q=user:USERNAME
const searchResults = await octokit.paginate(octokit.rest.search.repos, { const searchResults = await octokit.paginate(octokit.rest.search.repos, {
q: `user:${user}`, q: query,
per_page: 100, per_page: 100,
request: { request: {
signal, signal,