Fix GitHub public archived repos appearing even when exclude archived is set to true
Created by: varsanojidan
Closes https://github.com/sourcegraph/sourcegraph/issues/38590
This PR is to fix two things:
- There is a big in the repositoryQuery option for GitHub codehosts where if you specify "public" and have archived repos excluded, the archived repos still show up on SG.
- The search functionality for repositoryQuery as a whole had a bug in it that could cause it to loop infinitely, the bug is fixed and the logic should be simplified.
The fix for the search functionality is considered needed for the fix of the GitHub public archived repo issue, without it for example, running this locally against dogfood would result in an infinite loop.
Test plan
Tested locally on my machine against dogfood ghe, set it to only clone public non-archived repos, reached arounf 130k repos after a few hours. Verified the inverse query (is:public archived:true) returns the 1 matching repo correctly.