To get a fork name we are using the list forks API which is paginated. So we end up going through each page until we find the fork. This would result in 24 API calls in case like these - https://github.com/kiegroup/drools/pull/5116
Now we are using the list forks API since there are cases where the forked repository name might be different than the original repository. However after investigating the forks of some our major repositories, it seems like most of the forked repositories have the same name as the original repository. The ones with different name are generally way less (although they do exist). These are the repositories I checked but I think the general trend is the same in the other repositories:
This PR aims to take advantage of this fact and reduce the number of API calls. The idea is that we will directly check whether a forked repository with same name exists or not. If it exists then we are done and we don't have to loop through all the forks.
Taking the same example, for this PR https://github.com/kiegroup/drools/pull/5116 we would make about 24 API calls to get the fork name, but now with this change we will only make 1.
So we will be able to reduce the number of API calls for the majority of the cases. For the rest we still have to investigate :)
Part of #410
To get a fork name we are using the list forks API which is paginated. So we end up going through each page until we find the fork. This would result in 24 API calls in case like these - https://github.com/kiegroup/drools/pull/5116
Now we are using the list forks API since there are cases where the forked repository name might be different than the original repository. However after investigating the forks of some our major repositories, it seems like most of the forked repositories have the same name as the original repository. The ones with different name are generally way less (although they do exist). These are the repositories I checked but I think the general trend is the same in the other repositories:
This PR aims to take advantage of this fact and reduce the number of API calls. The idea is that we will directly check whether a forked repository with same name exists or not. If it exists then we are done and we don't have to loop through all the forks.
Taking the same example, for this PR https://github.com/kiegroup/drools/pull/5116 we would make about 24 API calls to get the fork name, but now with this change we will only make 1.
So we will be able to reduce the number of API calls for the majority of the cases. For the rest we still have to investigate :)