feat: Add support for repository search query to optimize repo enumeration#373
Merged
feat: Add support for repository search query to optimize repo enumeration#373
Conversation
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] feat: Efficient repository enumeration via search API use
Add support for repository search query to optimize repo enumeration
Jul 7, 2025
Member
|
@copilot This new configuration option needs to be documented in the |
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Contributor
Author
Signed-off-by: Zack Koppert <zkoppert@github.com>
Member
|
@copilot can you fix the failed github action job that reports that the MARKDOWN_PRETTIER linter is failing? |
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Contributor
Author
Signed-off-by: Zack Koppert <zkoppert@github.com>
Member
Signed-off-by: Zack Koppert <zkoppert@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new feature to optimize repository enumeration by adding support for GitHub Search API queries through the REPOSITORY_SEARCH_QUERY environment variable. This allows users to filter repositories upfront using search queries instead of enumerating all organization repositories, potentially saving API rate limits and processing time.
- Adds
REPOSITORY_SEARCH_QUERYenvironment variable support to use GitHub Search API for targeted repository filtering - Updates documentation to describe the new search query functionality
- Enables markdown prettier formatting in the super-linter workflow
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| evergreen.py | Implements the core functionality to check for and use the search query environment variable |
| README.md | Documents the new REPOSITORY_SEARCH_QUERY parameter and fixes link formatting |
| .github/workflows/super-linter.yaml | Enables markdown prettier formatting |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Zack Koppert <zkoppert@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
Member
|
@copilot Write test cases to cover the use of |
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Contributor
Author
… match other repo iterators Signed-off-by: Zack Koppert <zkoppert@github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
zkoppert
approved these changes
Jul 15, 2025
jmeridth
approved these changes
Jul 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This pull request introduces support for a new
REPOSITORY_SEARCH_QUERYfeature, enhances documentation, and includes minor updates to workflows and code. The most significant changes involve adding the ability to filter repositories using a search query, updating theREADME.mdto reflect this feature, and modifying theenv.pyandevergreen.pyfiles to handle the new functionality.This allows GitHub Search API (
github_connection.search_repositories) instead of enumerating all organization repositories. This allows callers to supply queries like:and only iterate over matching repositories up‑front, saving time and API rate limits. Existing behavior remains unchanged when the variable is not set, and all existing unit tests continue to pass.
Fixes #372.
Details
New Feature: Repository Search Query Support
REPOSITORY_SEARCH_QUERYenvironment variable inenv.py. This allows filtering repositories using a GitHub Search API query. Updated theget_env_varsfunction to validate that at least one ofORGANIZATION,REPOSITORY, orREPOSITORY_SEARCH_QUERYis set. [1] [2] [3] [4]get_repos_iteratorinevergreen.pyto handle repository filtering via the search query. IfREPOSITORY_SEARCH_QUERYis set, the GitHub Search API is used to retrieve matching repositories.mainfunction inevergreen.pyto pass thesearch_queryparameter toget_repos_iterator. [1] [2]Documentation Updates
README.mddemonstrating how to use theREPOSITORY_SEARCH_QUERYvariable in a GitHub Actions workflow.README.mdto includeREPOSITORY_SEARCH_QUERYas a supported variable, explaining its purpose and usage. Improved clarity in other sections, such as linking to GitHub documentation for encrypted secrets. [1] [2]Minor Improvements
FIX_MARKDOWN_PRETTIER: truein.github/workflows/super-linter.yaml.# pragma: no covercomment inenv.pyto exclude certain branches from test coverage.Testing
I tested this on the github org and created 43 new PRs!
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
🚧 Copilot coding agent is using an experimental model for this task. Please take the time to report feedback with the 👍 or 👎 buttons.