DPGAlliance / publicgoods-scripts

Scripts to generate static site from WordPress
http://digitalpublicgoods.net
MIT License
4 stars 6 forks source link

Github activity graph is not shown for DPGs #248

Open PelinSmines opened 7 months ago

PelinSmines commented 7 months ago

On Registry page we show the Last year activity of the DPGs via Github. Currently only these products seem to have last year activity: Bisa Health ekShop Marketplace NiSE3 Skills and Certification Safe YOU

For example this DPG (https://app.digitalpublicgoods.net/a/11138) has activity in Github: https://github.com/investtools/ivttoken but it is not visible in Registry.

All the DPGS that have source code in Github and have activity in the past year must have their custom activity graph shown in the Registry list on the Registry page.

law909 commented 7 months ago

Github changed their way to draw activity graph and changed their pages HTML structure. We try to extract the activity graph from pages like this from some "poll[src]" tags but there is no tags like that. By the way, if an organization has multiple repositories, our current code downloaded the activity graph of the most starred repo, even if it wasn't the DPG's repository.

Needs a complete rewrite.

PelinSmines commented 7 months ago

@law909 @gazdagergo we need to chose the quick fix option as we may not have this function on the new version of the Registry.

PelinSmines commented 2 months ago

@law909 @gazdagergo as it looks like, we may have this graph in the new version of the Registry. Both the product owners and the members seem to find it useful. So we need to assess the re-write of this feature.

law909 commented 2 months ago

@PelinSmines There is no official way to get the graph. We can try to get it by scraping the user's main page html, but it is really a workaround that will stop working again when Github changes the HTML of that page. It is more likely that we won't be able to do it than that we will.

PelinSmines commented 2 months ago

What about using this or this info @law909 ? I will ask Ricardo which is more preferable from usefulness pov.

law909 commented 2 months ago

@PelinSmines there are some APIs to access those data, I will check what we can access through those.

gazdagergo commented 2 months ago

@PelinSmines We did a quick task refinement with Balint @law909 , and we agreed that it’s definitely possible to do this the proper way by writing its business logic. However, it requires further analysis on authentication, data fetching, and visualization. Once we have that, we can provide an estimate and ideally this task can go to the roadmap to make its priority and deadline more visible.

As a fallback, we could fix the scraper logic that collects the images from GitHub. However, this method is unreliable, as it can cause silent errors if GitHub changes its HTML structure.

law909 commented 2 months ago

https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#about-repository-statistics

PelinSmines commented 2 months ago

What about this: https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-last-year-of-commit-activity @law909 @gazdagergo

PelinSmines commented 3 weeks ago

@law909 https://github.com/DPGAlliance/publicgoods-review-webapp-v1.5/issues/66 related?