Rustc-dev-guide: Only run linkcheck on changed files

Created on 22 Sep 2020  路  5Comments  路  Source: rust-lang/rustc-dev-guide

From @mark-i-m in this Zulip thread:

It doesn't sound too hard to add a way for mdbook-linkcheck to only check a list of given files. Then, we could have the CI script list the changed files from git as those arguments and only check the changed files. And we could have a cron job that runs the full check periodically (like we already do).

This would probably reduce the number of the annoying 429 Too Many Requests errors.

Most helpful comment

Michael-F-Bryan/mdbook-linkcheck#41 has merged... I'll try to put up some sort of PR soon...

All 5 comments

We could get the list of changed files with this command:

$ git diff-tree --no-commit-id --name-only -r HEAD
src/const-eval.md

This command is a plumbing command according to this Stack Overflow answer, so it should be fine to use in a script. The output looks good, it just lists each changed file on a newline.

Is it possible to only check certain files with mdbook-linkcheck?

Is it possible to only check certain files with mdbook-linkcheck?

TMK, no, but it looks like it wouldn't be too hard to add... it looks like you could add a flag to mdbook-linkcheck and plumb it through to here: https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/b6409a631f7294eeadca7cf9d77985488086ac67/src/lib.rs#L160 Then, just filter out the files you don't want...

Also useful: https://docs.travis-ci.com/user/cron-jobs/#detecting-builds-triggered-by-cron

With this we can leave off the aforementioned flag in cron jobs to get the full build.

Michael-F-Bryan/mdbook-linkcheck#41 has merged... I'll try to put up some sort of PR soon...

Was this page helpful?
0 / 5 - 0 ratings