Closed f-hollow closed 1 week ago
Interesting.
I think we could add that to our documentation at https://github.com/lycheeverse/lycheeverse.github.io
It could be next to this recipe in the documentation hierarchy: https://lychee.cli.rs/github_action_recipes/add-pr-comment/
Would you like to create a pull request? Otherwise I can also take care of it.
I have to use git stash, otherwise GitHub CI complains about the untracked file links-main.txt (not sure why it works like this): $ git checkout my_feature_branch error: The following untracked working tree files would be overwritten by checkout: links-main.txt Please move or remove them before you switch branches. Aborting
That's weird. When I remove the Stash untracked files
and Apply stashed changes
, it still works for me.
Could this be implemented in the action or lychee itself?
I guess it could be. Question is if we should. It would be a maintenance burden. Is copy-pasting the GitHub workflow an issue?
@mre I still want to implement checking internal links affected by removed files as mentioned above. Once I finish, I will create a pull request to add this information to the docs as you suggested.
It might take a couple of weeks though, since I am a bit busy recently.
Cool. Thanks a lot!
@f-hollow, any updates? Would love to have this.
@f-hollow, any updates? Would love to have this.
Thank you very much for waiting.
This workflow has been running in my repo all this time and there are two instances of strange behavior which I would like to inspect. Then I should be able to create a PR, most likely no later than next week.
Just noticed that a PR has already been created. Thank you @sekyondaMeta!
In this case, I will see if any improvements are needed :)
I guess that's a misunderstanding. The referenced pull request targets pytorch/tutorials
, not the lychee docs. I went ahead and created a recipe in our documentation here. The original commit is here.
Please double-check if I made a mistake and feel free to update the docs over there.
Apart from that, it looks like we're done here. Thanks for the great idea to use --dump
to get a diff to the base branch.
Naturally, it is desirable to minimize bothering your contributor with issues introduced by somebody else in your repo. So I need a way to check and report invalid links (1) added / updated in that contributor's PR only, or (2) existing links affected by the introduced changes.
It appeared to be harder than I expected. You cannot run lychee on the changes only, because the links internal to your repo (checked with my beloved
--include-fragments
option) can and will produce false positives.Browsing around this repo, I came across mre's comment about separately checking existing links and new links. This idea nudged me in the right direction! The related issues #17 and #134 offer no immediately usable solution yet.
Below is the workflow that I created and tested so far. It works and does what I need.
Possible improvements:
git stash
, otherwise GitHub CI complains about the untracked filelinks-main.txt
(not sure why it works like this):Action: I wonder if there is a way to further simplify the steps or reduce their number (like not using
git stash
)?.lycheeignore
still contains them. My repo has a cron job checking all links in main once a week, which should take care of such issues for the time being. Action: In this workflow, it might be good to recheck existing internal links affected by removed files.Your feedback or further improvements to this workflow would be very much appreciated!
The workflow that checks links relevant to the changes in a PR only