openjs-foundation / package-json-research

18 stars 2 forks source link

Add a link checking tool #6

Open Ethan-Arrowood opened 12 months ago

Ethan-Arrowood commented 12 months ago

I've seen these before but never set one up myself. I'd like us to have some sort of link-checking cron job. It should check all links in our markdown documents and alert us when one 404s. The job should open an issue automatically reporting the 404'ing URL.

I don't think it should be apart of the lint step. Someone else work should not be blocked because another URL stopped working.

escodel commented 6 months ago

@Ethan-Arrowood playing around with an idea for this where basically a GitHub Action scans the repo for *.md files for links on a daily basis (cron job can be set for whatever is preferred) then curls for status. If status is 404 it then hits the GitHub api to submit an Issue.

Need to tie the link to the filename, and probably the Bearer auth token etc to submit the issue through the GitHub REST API with that data included. Does that sound like what you might be looking for?

Ethan-Arrowood commented 6 months ago

Yes pretty much - I think there are existing tools that do this already so I'd prefer to use one of those before rolling it ourselves.

ljharb commented 6 months ago

There's one on the CPC repo i think you can just summarily cargocult.

escodel commented 6 months ago

Ah, yeah I see it's using linkinator in the GH Action workflow there. Well, it was a fun way to spend part of my evening! 😂