You can use Github GraphQL API and use aliases for each possible filename, for example:
readme1: object(expression: "master:README.md") {
...
}
readme2: object(expression: "master:README.MD") {
...
}
The idea is that you perform only one request for the search and content. Also you can add more repository
aliases and the cost remains at 1 point for each request which drastically reduces chance to reach rate limit.
For example the following will get the readme with 5 filenames possibilities for 2 repositories and this request only cost 1 point:
{
repo1: repository(name: "material-ui", owner: "mui-org") {
...RepoFragment
}
repo2: repository(name: "linux", owner: "torvalds") {
...RepoFragment
}
rateLimit {
cost
remaining
limit
}
}
fragment RepoFragment on Repository {
readme1: object(expression: "master:README.md") {
...ReadmeText
}
readme2: object(expression: "master:README.MD") {
...ReadmeText
}
readme3: object(expression: "master:readme.md") {
...ReadmeText
}
readme4: object(expression: "master:Readme.md") {
...ReadmeText
}
readme5: object(expression: "master:README") {
...ReadmeText
}
}
fragment ReadmeText on GitObject {
... on Blob {
text
}
}
try this in the explorer
In the output:
"rateLimit": {
"cost": 1,
"remaining": 4977,
"limit": 5000
}
This means that you can take advantage of aliases to slice your repository array into graphql aliases like above by building the request dynamically. You are only limited by the time it takes to process the query, so you must have a max number of repository per request. See this post for an example to build the query dynamically. Another post which maybe is more simple
Also, see graphql resource limitations doc