r-world-devs / GitStats

An R package to get data from GitHub and GitLab in standard format.
https://r-world-devs.github.io/GitStats/
Other
3 stars 1 forks source link

Allow for defining connections for different modes (ors/repo) in the same GitHost object. #400

Open marcinkowskak opened 7 months ago

marcinkowskak commented 7 months ago

Let's assume we want to get information on repos in a manner below - whole organization and one chosen repository. We get the following error:

> GitStats::create_gitstats() %>%
+   GitStats::set_github_host(
+     orgs = "openpharma"
+   ) %>% 
+   GitStats::set_github_host(
+     repos = "r-world-devs/GitStats"
+   )
ℹ Using PAT from GITHUB_PAT envar.
ℹ Your search parameter set to [org].
ℹ Checking passed organizations...
✔ Set connection to GitHub.
ℹ Using PAT from GITHUB_PAT envar.
ℹ Your search parameter set to [repo].
✔ Set connection to GitHub.
Error:
✖ You can not provide two hosts of the same API urls.
ℹ If you wish to change/add more organizations you can do it with `set_organizations()` function.
Run `rlang::last_trace()` to see where the error occurred.

It would be nice to have more flexibility in that manner - as right now to get the result I want I need to create two GitStats objects.

maciekbanas commented 7 months ago

@marcinkowskak that is ok, but still for setting hosts you need to add two different hosts. In the example above you are trying to add the same host, two times - and that is the reason of the error (see the message). I understand you wish that you could add for one host repos and for other orgs? Or do you mean something else in this issue?

marcinkowskak commented 7 months ago

Yes, I want to scan whole organization and couple of chosen repos - here from public GitHub at once.

The other case was when I was trying to scan chosen repos from host A, and the whole org from host B, in both cases I was getting whole orgs - this is now fixed as I see in the #403

maciekbanas commented 7 months ago

All right I got it. So, I created an issue I address in the PR right here #404 And this issue will be managed after release.

maciekbanas commented 7 months ago

@marcinkowskak this feature you mention, would change a bit logic of setting searching scope. We have to think carefully, how to approach it, maybe instead of repos and org parameters it would be better to have scope param.

marcinkowskak commented 7 months ago

I understand. We can leave it as it is now and get back to the subject later.