fatih-yavuz / links.dev

A free linktree alternative only for devs. Get a nice page at links.dev/username. Simple site to group all your links. Register your username before someone else does.
MIT License
227 stars 149 forks source link

Suggestion: CI only work for newly added username/domain #125

Closed haliliceylan closed 1 year ago

haliliceylan commented 1 year ago

Hi,

Now CI checks the previous usernames every time it runs. A previously added user's problematic web page can explode CI.

To fix this, only the newly added username/domain should be checked under PR.

bsoyka commented 1 year ago

I like this. @fatih-yavuz, thoughts?

fatih-yavuz commented 1 year ago

I agree, it is a good idea. We can do that. Also, the existing users with problem can be warned as a following step. Feel free to open a PR

haliliceylan commented 1 year ago

Does anyone have an idea how to do this, as we can only get the changed lines with git commands, but I don't know how to preserve the syntax of the yaml file.

fatih-yavuz commented 1 year ago

I can take a look at it tomorrow evening CET

haliliceylan commented 1 year ago

I did some research about that, maybe;

Or

Or

Just brain storm.

xYundy commented 1 year ago

You can get current production registry.yaml using Git (or just download it https://github.com/fatih-yavuz/links.dev/raw/main/registry.yaml) to temporary directory.

And now you can directly in NodeJS script calculate the diff and check only newly added users.

fatih-yavuz commented 1 year ago

The last approach sounds pretty easy and doable.

xYundy commented 1 year ago

@fatih-yavuz I wrote a simple implementation of that behaviour.

It's behind feature flag (currently directly in script, but I can be also read from cli param or .env file if you wish).