librariesio / libraries.io

:books: The Open Source Discovery Service
https://libraries.io
GNU Affero General Public License v3.0
1.1k stars 206 forks source link

Set Repository Status Based on Upstream Status #3336

Closed mikeyoung85 closed 3 months ago

mikeyoung85 commented 3 months ago

This slightly changes the logic in the Github fetch_repo logic to set the status property every time instead of just if the repository was found to be archived. This will allow Libraries to reset the Repository status if something is unarchived. I also moved some status setting logic out of the Readme class and moved it into Repository to make it more visible. I've tested the updated logic locally for the use cases I know about, but let me know if something looks off in here as I've had several different versions of refactors going at the same time.

I think there is a much larger refactor needed to separate out the update logic between the RepositoryHost class and the Repository class that I am aiming to tackle in the next few days, so I expect that logic to move somewhere else into a discrete method/class responsible for setting statuses correctly based on upstream repository data.

mikeyoung85 commented 3 months ago

I'll reopen after I work through how to set nil and Unmaintained statuses correctly

mikeyoung85 commented 3 months ago

I refactored things a little bit. I've changed the RepositoryHost.update_from_host method to read the archived field, which is supported by Github and Gitlab only, and use that to ask the Repository for the correct status to set. I've changed the moved Readme code to be a little more explicit about what it is doing.